1 // VISU VISUGUI : GUI of VISU component
3 // Copyright (C) 2003 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
38 #include <qptrvector.h>
39 #include <qcolordialog.h>
40 #include <qdatetime.h>
43 #include <vtkRenderer.h>
44 #include <vtkRenderWindow.h>
45 #include <vtkActorCollection.h>
46 #include <vtkTimerLog.h>
49 #include "SALOME_LifeCycleCORBA.hxx"
51 #include "SUIT_ResourceMgr.h"
52 #include "SUIT_MessageBox.h"
54 #include "SUIT_ViewWindow.h"
55 #include "SUIT_ViewManager.h"
57 #include "CAM_Module.h"
59 #include "SVTK_ViewWindow.h"
60 #include "SVTK_ViewModel.h"
61 #include "SVTK_Functor.h"
63 #include "SPlot2d_ViewModel.h"
64 #include "VisuGUI_SetupPlot2dDlg.h"
65 #include "Plot2d_SetupCurveDlg.h"
66 #include "Plot2d_ViewManager.h"
68 #include "OB_Browser.h"
70 #include "SALOME_ListIO.hxx"
71 #include "SALOME_ListIteratorOfListIO.hxx"
73 #include "SalomeApp_Application.h"
74 #include "SalomeApp_DataModel.h"
75 #include "SalomeApp_Study.h"
76 #include "SalomeApp_CheckFileDlg.h"
77 #include "LightApp_SelectionMgr.h"
78 #include "LightApp_Selection.h"
79 #include "LightApp_Preferences.h"
81 #include "QtxAction.h"
83 #include "VISUConfig.hh"
84 #include "VISU_Gen_i.hh"
85 #include "VISU_Mesh_i.hh"
86 #include "VISU_Table_i.hh"
87 #include "VISU_Result_i.hh"
88 #include "VISU_View_i.hh"
89 #include "VISU_ViewManager_i.hh"
90 #include "VISU_Plot3D_i.hh"
92 #include "VISU_Actor.h"
94 #include "VisuGUI_Prs3dTools.h"
95 #include "VisuGUI_Tools.h"
97 #include "VisuGUI_PopupTools.h"
98 #include "VisuGUI_NameDlg.h"
99 #include "VisuGUI_CursorDlg.h"
100 #include "VisuGUI_Selection.h"
101 #include "VisuGUI_TimeAnimation.h"
102 #include "VisuGUI_EditContainerDlg.h"
103 #include "VisuGUI_ClippingDlg.h"
104 #include "VisuGUI_Plot3DDlg.h"
105 #include "VisuGUI_OffsetDlg.h"
106 #include "VisuGUI_Displayer.h"
107 #include "VisuGUI_BuildProgressDlg.h"
108 #include "VisuGUI_TransparencyDlg.h"
110 #include "VISU_ScalarMap_i.hh"
111 #include "VisuGUI_ScalarBarDlg.h"
113 #include "VISU_DeformedShape_i.hh"
114 #include "VisuGUI_DeformedShapeDlg.h"
116 #include "VISU_ScalarMapOnDeformedShape_i.hh"
117 #include "VisuGUI_ScalarMapOnDeformedShapeDlg.h"
119 #include "VISU_IsoSurfaces_i.hh"
120 #include "VisuGUI_IsoSurfacesDlg.h"
122 #include "VISU_CutPlanes_i.hh"
123 #include "VisuGUI_CutPlanesDlg.h"
125 #include "VISU_CutLines_i.hh"
126 #include "VisuGUI_CutLinesDlg.h"
128 #include "VISU_StreamLines_i.hh"
129 #include "VisuGUI_StreamLinesDlg.h"
131 #include "VISU_Vectors_i.hh"
132 #include "VisuGUI_VectorsDlg.h"
134 #include "VisuGUI_TableDlg.h"
136 #include "SALOMEconfig.h"
137 #include CORBA_SERVER_HEADER(MED_Gen)
139 #include "utilities.h"
141 #include "VisuGUI_ActionsDef.h"
143 #include "VisuGUI_Timer.h"
145 #include "VVTK_ViewModel.h"
147 using namespace VISU;
150 static int MYDEBUG = 1;
152 static int MYDEBUG = 0;
155 //////////////////////////////////////////////////
157 //////////////////////////////////////////////////
160 SalomeApp_Module( "VISU" ),
174 if(MYDEBUG) MESSAGE("VisuGUI::OnImportFromFile()");
175 if ( CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)) )
178 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
182 aFilter.append( tr( "FLT_MED_FILES" ) );
183 aFilter.append( tr( "FLT_ALL_FILES" ) );
185 bool toUseBuildProgress = aResourceMgr->booleanValue("VISU", "use_build_progress", false);
187 SalomeApp_CheckFileDlg* fd = new SalomeApp_CheckFileDlg( GetDesktop(this), true, tr("USE_BUILD_PROGRESS") );
188 fd->setCaption( tr( "IMPORT_FROM_FILE" ) );
189 fd->setFilters( aFilter );
190 fd->SetChecked( toUseBuildProgress );
192 QFileInfo aFileInfo( fd->selectedFile() );
193 toUseBuildProgress = fd->IsChecked();
196 // Check the file name
197 if ( !aFileInfo.exists() )
200 if ( !toUseBuildProgress )
202 bool toBuildFields = aResourceMgr->booleanValue( "VISU", "build_fields", true );
203 bool toBuildMinMax = aResourceMgr->booleanValue( "VISU", "build_min_max", true );
204 bool toBuildGroups = aResourceMgr->booleanValue( "VISU", "build_groups", true );
205 bool toBuildAll = aResourceMgr->booleanValue( "VISU", "full_med_loading", false );
206 bool toBuildAtOnce = aResourceMgr->booleanValue( "VISU", "build_at_once", false );
208 QString anInfo("Importing From File " + aFileInfo.filePath() + "..." );
209 application()->putInfo( anInfo );
211 QApplication::setOverrideCursor(Qt::waitCursor);
212 VISU::Result_var aResult = GetVisuGen(this)->CreateResult( aFileInfo.filePath() );
214 if (CORBA::is_nil(aResult.in())) {
215 SUIT_MessageBox::warn1(GetDesktop(this),
217 VisuGUI_BuildProgressDlg::tr("ERR_ERROR_IN_THE_FILE"),
219 QApplication::restoreOverrideCursor();
221 aResult->SetBuildFields( toBuildFields, toBuildMinMax );
222 aResult->SetBuildGroups( toBuildGroups );
223 aResult->Build( toBuildAll, toBuildAtOnce );
225 UpdateObjBrowser(this);
226 application()->putInfo( anInfo + tr("INF_DONE"));
227 QApplication::restoreOverrideCursor();
232 VisuGUI_BuildProgressDlg* aBuildProgressDlg = new VisuGUI_BuildProgressDlg( GetDesktop(this) );
233 aBuildProgressDlg->setFileName( aFileInfo.filePath() );
234 aBuildProgressDlg->setGenerator( GetVisuGen(this) );
235 aBuildProgressDlg->show();
241 OnImportTableFromFile()
243 if(MYDEBUG) MESSAGE("VisuGUI::OnImportTableFromFile()");
244 if ( CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)) )
248 aFilter.append( tr("FLT_TABLE_FILES") );
249 aFilter.append( tr("FLT_ALL_FILES") );
251 QFileInfo aFileInfo =
252 SUIT_FileDlg::getFileName(GetDesktop(this),
255 tr("MEN_IMPORT_TABLE"),
257 if (aFileInfo.exists()) {
258 application()->putInfo( tr("MEN_IMPORT_TABLE") + " " + aFileInfo.filePath() + " ..." );
260 CORBA::Object_var anObject = GetVisuGen(this)->ImportTables(aFileInfo.filePath());
262 if (CORBA::is_nil(anObject.in())) {
263 SUIT_MessageBox::warn1(GetDesktop(this),
265 tr("ERR_ERROR_IN_THE_FILE"),
268 application()->putInfo(aFileInfo.filePath()+tr("INF_DONE"));
269 UpdateObjBrowser(this);
276 OnExportTableToFile()
278 if(MYDEBUG) MESSAGE("VisuGUI::OnExportTableToFile()");
280 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
282 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
283 SALOME_ListIO aListIO;
284 aSelectionMgr->selectedObjects(aListIO);
286 if (aListIO.Extent() > 0) {
287 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
288 if (anIO->hasEntry()) {
289 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
292 // find table attribute
294 _PTR(GenericAttribute) anAttr;
296 if (!aSObj->FindAttribute(anAttr, "AttributeTableOfReal")) {
298 if (!aSObj->FindAttribute(anAttr, "AttributeTableOfInteger")) {
299 // if the current SObject is a table title
300 // we take a father contaning the table
301 aSObj = aSObj->GetFather();
303 if (aSObj->FindAttribute(anAttr, "AttributeTableOfReal")) {
306 if (!aSObj->FindAttribute(anAttr, "AttributeTableOfInteger")) {
313 // get table title in order to have default name of the file
316 _PTR(AttributeTableOfReal) aTabAttr (anAttr);
317 if (!aTabAttr) return;
318 aTitle = aTabAttr->GetTitle().c_str();
320 _PTR(AttributeTableOfInteger) aTabAttr (anAttr);
321 if (!aTabAttr) return;
322 aTitle = aTabAttr->GetTitle().c_str();
324 aTitle.simplifyWhiteSpace();
325 aTitle = aTitle.replace(QRegExp(" "), "_").replace(QRegExp("\\*"), "" );
327 // get default path for the file
328 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
329 QString aDir = aResourceMgr->stringValue("VISU","OutputDir","");
330 if (aDir.isEmpty()) {
331 aDir = aResourceMgr->stringValue("VISU","InputDir","");
332 if (aDir.isEmpty()) {
333 aDir = getenv("CSF_PATHData");
336 QString aPath = Qtx::addSlash(aDir) + aTitle;
338 // get name for the file
340 aFilter.append("Table Files (*.xls)");
342 QFileInfo aFileInfo =
343 SUIT_FileDlg::getFileName(GetDesktop(this),
346 tr("MEN_EXPORT_TABLE"), // "Export Table To File"
350 QString aFile = aFileInfo.filePath();
351 if (!aFile.isEmpty()) {
352 application()->putInfo(tr("MEN_EXPORT_TABLE") + " " + aFile + " ...");
353 aDir = Qtx::dir(aFile, true);
354 aResourceMgr->setValue("VISU", "OutputDir", aDir);
357 GetVisuGen(this)->ExportTableToFile(GetSObject(aSObj), aFile.latin1());
358 application()->putInfo(aFile + " " + tr("INF_DONE"));
359 } catch(std::exception& exc) {
361 SUIT_MessageBox::warn1(GetDesktop(this),
363 tr("ERR_ERROR_DURING_EXPORT") + " " + tr(exc.what()),
366 INFOS(tr("ERR_ERROR_DURING_EXPORT"));
367 SUIT_MessageBox::warn1(GetDesktop(this),
369 tr("ERR_ERROR_DURING_EXPORT"),
381 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
382 if (CheckLock(aCStudy,GetDesktop(this)))
384 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
386 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
387 SALOME_ListIO aListIO;
388 aSelectionMgr->selectedObjects(aListIO);
390 SALOME_ListIteratorOfListIO It (aListIO);
391 QApplication::setOverrideCursor(Qt::waitCursor);
392 for (; It.More(); It.Next()) {
393 Handle(SALOME_InteractiveObject) anIO = It.Value();
394 SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
395 if (!aSObject->_is_nil()) {
396 CORBA::Object_var anObject = VISU::SObjectToObject(aSObject);
397 if (!CORBA::is_nil(anObject)) {
398 SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
399 if (!CORBA::is_nil(aMED.in()))
400 GetVisuGen(this)->ImportMed(aSObject);
401 SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject);
402 if (!CORBA::is_nil(aField.in()))
403 GetVisuGen(this)->ImportMedField(aField);
405 SALOMEDS::SObject_var aSFather = aSObject->GetFather();
406 SALOMEDS::GenericAttribute_var anAttr;
407 aSFather->FindAttribute(anAttr, "AttributeName");
408 SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
409 CORBA::String_var aValue = aName->Value();
410 if (strcmp(aValue.in(), "MEDFIELD") == 0)
411 GetVisuGen(this)->ImportMed(aSObject);
415 UpdateObjBrowser(this, true);
416 QApplication::restoreOverrideCursor();
420 CreateCurves( SalomeApp_Module* theModule,
421 VISU::CutLines_i* thePrs,
423 const bool theCreate = true )
427 VisuGUI_CutLinesDlg* aCutDlg = dynamic_cast<VisuGUI_CutLinesDlg*>( theDlg );
431 _PTR(Study) aStudy = GetCStudy( GetAppStudy( theModule ) );
432 _PTR(SObject) aSObject = aStudy->FindObjectID( thePrs->GetEntry().latin1() );
434 if ( !theCreate && aSObject ) {
436 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
437 _PTR(ChildIterator) aIter = aStudy->NewChildIterator(aSObject);
438 for (; aIter->More(); aIter->Next()) {
439 _PTR(SObject) aTblObj = aIter->Value();
441 _PTR(GenericAttribute) anAttr;
442 if (aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
443 aBuilder->RemoveObjectWithChildren( aTblObj ); // We should have only one child
444 UpdateObjBrowser(theModule,true,aTblObj);
451 if ( aCutDlg->isGenerateTable() ) {
452 GetVisuGen( theModule )->CreateTable( thePrs->GetEntry() );
453 if ( aCutDlg->isGenerateCurves() ) {
455 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
456 _PTR(ChildIterator) aIter = aStudy->NewChildIterator(aSObject);
457 for (; aIter->More(); aIter->Next()) {
458 _PTR(SObject) aTblObj = aIter->Value();
460 _PTR(GenericAttribute) anAttr;
461 if ( aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
462 CreatePlot( theModule, aTblObj );
470 if (!theCreate && aSObject) {
471 UpdateObjBrowser(theModule);
479 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
480 if (CheckLock(aStudy,GetDesktop(this)))
483 // Get selected SObject
484 Handle(SALOME_InteractiveObject) anIO;
485 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
486 if (anIO.IsNull() || !anIO->hasEntry())
489 // create a VTK view window if it does not exist
490 SVTK_ViewWindow* aViewWindow = GetViewWindow<SVTK_Viewer>(this);
492 // create mesh presentation and display it in aViewWindow
493 CreateMesh(this, anIO, aViewWindow);
500 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
501 if (CheckLock(aStudy,GetDesktop(this)))
504 // create a VTK view window if it does not exist
505 SVTK_ViewWindow* aViewWindow = GetViewWindow<SVTK_Viewer>(this);
507 // Get selected SObject
508 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
509 SALOME_ListIO aListIO;
510 aSelectionMgr->selectedObjects(aListIO);
511 SALOME_ListIteratorOfListIO anIter (aListIO);
512 for (; anIter.More(); anIter.Next()) {
513 Handle(SALOME_InteractiveObject) anIO = anIter.Value();
514 if (anIO.IsNull() || !anIO->hasEntry())
517 // create mesh presentation and display it in aViewWindow
518 CreateMesh(this, anIO, aViewWindow);
526 CreatePrs3d<VISU::ScalarMap_i,VisuGUI_ScalarBarDlg,1>(this);
532 OnCreateDeformedShape()
534 CreatePrs3d<VISU::DeformedShape_i,VisuGUI_DeformedShapeDlg,1>(this);
539 OnCreateScalarMapOnDeformedShape()
541 CreatePrs3d<VISU::ScalarMapOnDeformedShape_i,VisuGUI_ScalarMapOnDeformedShapeDlg,1>(this);
548 CreatePrs3d<VISU::Vectors_i,VisuGUI_VectorsDlg,1>(this);
553 OnCreateIsoSurfaces()
555 CreatePrs3d<VISU::IsoSurfaces_i,VisuGUI_IsoSurfacesDlg,1>(this);
562 CreatePrs3d<VISU::CutPlanes_i,VisuGUI_CutPlanesDlg,0>(this);
569 CreatePrs3d<VISU::CutLines_i,VisuGUI_CutLinesDlg,0>(this);
574 OnCreateStreamLines()
576 CreatePrs3d<VISU::StreamLines_i,VisuGUI_StreamLinesDlg,1>(this);
583 CreatePrs3d<VISU::Plot3D_i,VisuGUI_Plot3DDlg,0>(this);
590 CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this));
591 GetVisuGen( this )->CreateContainer();
592 UpdateObjBrowser(this);
599 if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs");
601 LightApp_SelectionMgr* mgr = GetSelectionMgr(this);
604 QApplication::setOverrideCursor(Qt::waitCursor);
606 SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this);
608 SALOME_ListIO aSel, aList;
609 mgr->selectedObjects(aSel);
610 extractContainers(aSel, aList);
612 for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
613 Handle(SALOME_InteractiveObject) anIO = it.Value();
614 CORBA::Object_var anObject = GetSelectedObj(GetAppStudy(this), anIO->getEntry());
616 if (!CORBA::is_nil(anObject)) {
617 // is it Prs3d object ?
618 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
620 if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs : Prs3d object");
621 //UpdateViewer( this, aPrsObject );
623 displayer()->Display(anIO->getEntry());
624 vw->highlight(anIO, 1);
629 VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(anObject).in());
631 if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs : Curve object");
632 //PlotCurve( this, aCurve, VISU::eDisplay );
633 displayer()->Display(anIO->getEntry());
637 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(anObject).in());
639 if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Container object");
640 //PlotContainer( this, aContainer, VISU::eDisplay );
641 displayer()->Display(anIO->getEntry());
645 VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(anObject).in());
647 if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Table object");
648 //PlotTable( this, aTable, VISU::eDisplay );
649 displayer()->Display(anIO->getEntry());
656 vw->getRenderer()->ResetCameraClippingRange();
660 QApplication::restoreOverrideCursor();
675 if(MYDEBUG) MESSAGE("OnErasePrs");
677 QApplication::setOverrideCursor(Qt::waitCursor);
679 //SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this);
681 // vw->unHighlightAll();
683 SALOME_ListIO aList, aSel;
684 LightApp_SelectionMgr* mgr = GetSelectionMgr(this);
685 mgr->selectedObjects(aSel);
686 extractContainers(aSel, aList);
688 for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
689 Handle(SALOME_InteractiveObject) anIO = it.Value();
690 CORBA::Object_var anObject = GetSelectedObj(GetAppStudy(this), anIO->getEntry());
691 //ErasePrs(this, anObject, /*repaint_view_window = */false);
692 ErasePrs(this, anObject, /*repaint_view_window = */true);
698 QApplication::restoreOverrideCursor();
705 startOperation( myEraseAll );
706 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
707 vw->unHighlightAll();
708 if (vtkRenderer *aRen = vw->getRenderer()) {
710 vtkActorCollection *anActColl = aRen->GetActors();
711 for (anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ) {
712 if (anActor->GetVisibility() > 0)
713 if (VISU_Actor* anVISUActor = VISU_Actor::SafeDownCast(anActor)) {
714 RemoveScalarBarPosition(this, vw, anVISUActor->GetPrs3d());
715 anVISUActor->VisibilityOff();
720 } else if (SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(this, false)) {
730 Handle(SALOME_InteractiveObject) anIO;
731 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
732 EditPrs3d<VISU::ScalarMap_i, VisuGUI_ScalarBarDlg, 1>(this, anIO, aPrs3d);
737 OnEditDeformedShape()
739 Handle(SALOME_InteractiveObject) anIO;
740 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
741 EditPrs3d<VISU::DeformedShape_i, VisuGUI_DeformedShapeDlg, 1>(this, anIO, aPrs3d);
746 OnEditScalarMapOnDeformedShape()
748 Handle(SALOME_InteractiveObject) anIO;
749 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
750 EditPrs3d<VISU::ScalarMapOnDeformedShape_i, VisuGUI_ScalarMapOnDeformedShapeDlg, 1>(this, anIO, aPrs3d);
757 Handle(SALOME_InteractiveObject) anIO;
758 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
759 EditPrs3d<VISU::CutPlanes_i, VisuGUI_CutPlanesDlg, 0>(this, anIO, aPrs3d);
766 Handle(SALOME_InteractiveObject) anIO;
767 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
768 EditPrs3d<VISU::CutLines_i, VisuGUI_CutLinesDlg, 0>(this, anIO, aPrs3d);
775 Handle(SALOME_InteractiveObject) anIO;
776 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
777 EditPrs3d<VISU::IsoSurfaces_i, VisuGUI_IsoSurfacesDlg, 1>(this, anIO, aPrs3d);
784 Handle(SALOME_InteractiveObject) anIO;
785 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
786 EditPrs3d<VISU::Vectors_i, VisuGUI_VectorsDlg, 1>(this, anIO, aPrs3d);
793 Handle(SALOME_InteractiveObject) anIO;
794 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
795 EditPrs3d<VISU::StreamLines_i, VisuGUI_StreamLinesDlg, 1>(this, anIO, aPrs3d);
802 Handle(SALOME_InteractiveObject) anIO;
803 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
804 EditPrs3d<VISU::Plot3D_i, VisuGUI_Plot3DDlg, 0>(this, anIO, aPrs3d);
812 ChangeRepresentation(this, VISU::SURFACEFRAME);
819 ChangeRepresentation(this, VISU::INSIDEFRAME);
826 ChangeRepresentation(this, VISU::WIREFRAME);
833 ChangeRepresentation(this, VISU::SHADED);
840 ChangeRepresentation(this, VISU::POINT);
847 ChangeRepresentation(this, VISU::SHRINK);
854 SetShading(this, true);
861 SetShading(this, false);
868 Handle(SALOME_InteractiveObject) anIO;
869 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
870 if (CORBA::is_nil(anObject)) return;
871 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
872 if (!aServant.in()) return;
874 VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
877 SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this);
880 VISU_Actor* anActor = GetActor(aPrs3d, vw);
881 if (!anActor) return;
883 VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
884 VISU::DeformedShape_i* aDeformedShape = dynamic_cast<VISU::DeformedShape_i*>(aPrs3d);
885 SALOMEDS::Color anOldColor, aNewColor;
886 int aRepresent = anActor->GetRepresentation();
888 switch (aRepresent) {
890 anOldColor = aMesh->GetNodeColor();
892 case VISU::WIREFRAME :
893 case VISU::INSIDEFRAME :
894 anOldColor = aMesh->GetLinkColor();
897 case VISU::SURFACEFRAME :
898 anOldColor = aMesh->GetCellColor();
901 } else if (aDeformedShape) {
902 anOldColor = aDeformedShape->GetColor();
907 QColor aColor (int(255*anOldColor.R),
908 int(255*anOldColor.G),
909 int(255*anOldColor.B));
910 QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
911 if (aColorNew.isValid()) {
912 aNewColor.R = aColorNew.red()/255.;
913 aNewColor.G = aColorNew.green()/255.;
914 aNewColor.B = aColorNew.blue()/255.;
916 switch (aRepresent) {
918 aMesh->SetNodeColor(aNewColor);
920 case VISU::WIREFRAME :
921 case VISU::INSIDEFRAME :
922 aMesh->SetLinkColor(aNewColor);
925 case VISU::SURFACEFRAME :
926 aMesh->SetCellColor(aNewColor);
930 aDeformedShape->SetColor(aNewColor);
932 RecreateActor(this, aPrs3d);
938 OnChangeWireframeColor()
940 Handle(SALOME_InteractiveObject) anIO;
941 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
942 if (CORBA::is_nil(anObject)) return;
943 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
944 if (!aServant.in()) return;
946 VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
949 SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this);
952 VISU_Actor* anActor = GetActor(aPrs3d, vw);
953 if (!anActor) return;
955 if (VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d)) {
956 SALOMEDS::Color anOldColor = aMesh->GetLinkColor(), aNewColor;
957 QColor aColor (int(255*anOldColor.R),
958 int(255*anOldColor.G),
959 int(255*anOldColor.B));
960 QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
961 if (aColorNew.isValid()) {
962 aNewColor.R = aColorNew.red()/255.;
963 aNewColor.G = aColorNew.green()/255.;
964 aNewColor.B = aColorNew.blue()/255.;
965 aMesh->SetLinkColor(aNewColor);
966 RecreateActor(this, aMesh);
975 Handle(SALOME_InteractiveObject) anIO;
976 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
977 if (CORBA::is_nil(anObject)) return;
978 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
979 if (!aServant.in()) return;
981 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
982 if (!aPrsObject) return;
984 SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this);
987 VISU_Actor* anActor = GetActor(aPrsObject, vw);
988 if (!anActor) return;
990 VisuGUI_TransparencyDlg* aTransparencyDlg = new VisuGUI_TransparencyDlg( this );
991 aTransparencyDlg->show();
998 Handle(SALOME_InteractiveObject) anIO;
999 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1000 if (CORBA::is_nil(anObject)) return;
1001 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1002 if (!aServant.in()) return;
1004 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
1005 if (!aPrsObject) return;
1007 SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this);
1010 VISU_Actor* anActor = GetActor(aPrsObject, vw);
1011 if (!anActor) return;
1013 VisuGUI_CursorDlg* CursorDlg =
1014 new VisuGUI_CursorDlg (GetDesktop(this), tr("DLG_LINEWIDTH_TITLE"), TRUE);
1016 CursorDlg->Comment1->setText(tr("DLG_LINEWIDTH_CMT1"));
1017 CursorDlg->Comment2->setText(tr("DLG_LINEWIDTH_CMT2"));
1018 CursorDlg->SpinBox1->setMinValue(1);
1019 CursorDlg->SpinBox1->setMaxValue(10);
1021 float oldlwid = anActor->GetLineWidth();
1022 int intlwid = int(oldlwid);
1023 CursorDlg->SpinBox1->setValue(intlwid);
1025 int ret = CursorDlg->exec();
1027 intlwid = CursorDlg->SpinBox1->value();
1028 float newlwid = intlwid;
1029 anActor->SetLineWidth(newlwid);
1038 Handle(SALOME_InteractiveObject) anIO;
1039 CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
1041 if ( !CORBA::is_nil( anObject ) ) {
1042 VISU::Base_var aVisuObj = VISU::Base::_narrow( anObject );
1043 if ( !CORBA::is_nil( aVisuObj ) && aVisuObj->GetType() == VISU::TTABLE ) {
1044 CORBA::Object_ptr aTable = VISU::Table::_narrow( anObject );
1045 if( !CORBA::is_nil( aTable ) ) {
1046 VISU::Table_i* table = dynamic_cast<VISU::Table_i*>( VISU::GetServant(aTable).in() );
1048 SO = GetCStudy( GetAppStudy( this ) )->FindObjectID( table->GetObjectEntry() );
1053 // possibly this is Table SObject
1054 SO = GetCStudy( GetAppStudy( this ) )->FindObjectID( anIO->getEntry() );
1057 if( !IsSObjectTable( SO ) )
1060 VisuGUI_TableDlg* dlg = new VisuGUI_TableDlg( GetDesktop( this ),
1063 //SAL2670 Orientation of show tables
1064 VisuGUI_TableDlg::ttAuto,
1073 Handle(SALOME_InteractiveObject) anIO;
1074 CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
1075 _PTR(Study) aStudy = GetCStudy( GetAppStudy( this ) );
1076 _PTR(SObject) aSObject = aStudy->FindObjectID(anIO->getEntry());
1077 VISU::CutLines_var aCutLines = VISU::CutLines::_narrow( anObject );
1078 if(!aCutLines->_is_nil() || IsSObjectTable(aSObject)) {
1079 GetVisuGen( this )->CreateTable( aSObject->GetID().c_str() );
1080 UpdateObjBrowser(this);
1088 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1089 if (CheckLock(aCStudy,GetDesktop(this)))
1092 SALOME_ListIO aList;
1093 LightApp_SelectionMgr* mgr = GetSelectionMgr(this);
1094 mgr->selectedObjects(aList,QString::null,false);
1095 int i = 0, nbSelected = aList.Extent();
1096 if (nbSelected < 1) return;
1098 const char* entries [nbSelected];
1099 Handle(SALOME_InteractiveObject) anIO;
1100 for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
1102 if (anIO->hasEntry())
1103 entries[i++] = anIO->getEntry();
1106 if (nbSelected < 1) return;
1108 // There is a transaction
1109 _PTR(StudyBuilder) aStudyBuilder = aCStudy->NewBuilder();
1110 aStudyBuilder->NewCommand();
1112 for (i = 0; i < nbSelected; i++) {
1113 _PTR(SObject) aSObject = aCStudy->FindObjectID(entries[i]);
1115 DeleteSObject(this, aCStudy, aSObject);
1116 UpdateObjBrowser(this, true, aSObject);
1120 // Finish transaction
1121 aStudyBuilder->CommitCommand();
1128 Handle(SALOME_InteractiveObject) anIO;
1129 CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
1131 _PTR(GenericAttribute) anAttr;
1132 _PTR(AttributeName) aName;
1134 _PTR(Study) aStudy = GetCStudy( GetAppStudy( this ) );
1136 if ( !CORBA::is_nil( anObject ) ) {
1137 VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
1138 if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TTABLE) {
1139 // Table (VISU object) is selected
1140 CORBA::Object_ptr aTbl = VISU::Table::_narrow( anObject );
1141 if( !CORBA::is_nil( aTbl ) ) {
1142 VISU::Table_i* table = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTbl).in());
1144 _PTR(SObject) SO = aStudy->FindObjectID( table->GetObjectEntry() );
1145 if ( IsSObjectTable(SO) ) {
1146 // get name of SObject
1147 if ( SO->FindAttribute( anAttr, "AttributeName" ) ) {
1149 SOName = QString( aName->Value().c_str() );
1151 VisuGUI_SetupPlot2dDlg* dlg = new VisuGUI_SetupPlot2dDlg( SO, GetDesktop( this ) );
1152 if ( dlg->exec() == QDialog::Accepted ) {
1153 if ( !IsStudyLocked( aStudy ) ) {
1154 // if study is not locked - create new container, create curves and insert them
1155 // into container, then plot container if current viewer is of VIEW_PLOT2D type
1157 QValueList<int> verIndices;
1158 dlg->getCurvesSource( horIndex, verIndices );
1159 if ( horIndex >= 0 && verIndices.count() > 0 ) {
1160 CORBA::Object_var aContainer = GetVisuGen(this)->CreateContainer();
1161 if( !CORBA::is_nil( aContainer ) ) {
1162 VISU::Container_i* pContainer =
1163 dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
1165 for ( int i = 0; i < verIndices.count(); i++ ) {
1166 CORBA::Object_var aNewCurve =
1167 GetVisuGen(this)->CreateCurve( table->_this(), horIndex+1, verIndices[i]+1 );
1168 if( !CORBA::is_nil( aNewCurve ) ) {
1169 VISU::Curve_i* pCrv =
1170 dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aNewCurve).in());
1173 int marker, line, lineWidth;
1175 if ( dlg->getCurveAttributes(verIndices[i], isAuto, marker,
1176 line, lineWidth, color) && !isAuto ) {
1178 c.R = color.red() /255.;
1179 c.G = color.green()/255.;
1180 c.B = color.blue() /255.;
1181 pCrv->SetColor( c );
1182 pCrv->SetMarker( ( VISU::Curve::MarkerType )marker );
1183 pCrv->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1185 pContainer->AddCurve( pCrv->_this() );
1189 UpdateObjBrowser(this);
1190 PlotContainer( this, pContainer, VISU::eDisplay );
1196 // if study is locked just get curves info and plot them
1197 // if current viewer is of VIEW_PLOT2D type
1198 QPtrList<Plot2d_Curve> container;
1199 dlg->getCurves( container );
1200 if ( !container.isEmpty() ) {
1201 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
1202 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( SOName );
1212 else if ( !anIO.IsNull() ) {
1213 // check if Table SObject is selected
1214 SO = aStudy->FindObjectID( anIO->getEntry() );
1215 if ( IsSObjectTable(SO) ) {
1216 // get name of SObject
1217 if ( SO->FindAttribute( anAttr, "AttributeName" ) ) {
1219 SOName = QString( aName->Value().c_str() );
1221 VisuGUI_SetupPlot2dDlg* dlg = new VisuGUI_SetupPlot2dDlg( SO, GetDesktop( this ) );
1222 if ( dlg->exec() == QDialog::Accepted ) {
1223 if ( !IsStudyLocked( aStudy ) ) {
1224 // if study is not locked - create new table and container objects, create curves
1225 // and insert them into container, then plot container if current viewer is of VIEW_PLOT2D type
1227 QValueList<int> verIndices;
1228 dlg->getCurvesSource( horIndex, verIndices );
1229 if ( horIndex >= 0 && verIndices.count() > 0 ) {
1230 CORBA::Object_var aTable = GetVisuGen(this)->CreateTable( SO->GetID().c_str() );
1231 CORBA::Object_var aContainer = GetVisuGen(this)->CreateContainer();
1232 if ( !CORBA::is_nil( aTable ) && !CORBA::is_nil( aContainer ) ) {
1233 VISU::Table_i* pTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTable).in());
1234 VISU::Container_i* pContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
1236 if ( pContainer && pTable ) {
1237 for ( int i = 0; i < verIndices.count(); i++ ) {
1238 CORBA::Object_var aNewCurve = GetVisuGen(this)->CreateCurve
1239 ( pTable->_this(), horIndex+1, verIndices[i]+1 );
1240 if( !CORBA::is_nil( aNewCurve ) ) {
1241 VISU::Curve_i* pCrv = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aNewCurve).in());
1244 int marker, line, lineWidth;
1246 if ( dlg->getCurveAttributes(verIndices[i], isAuto, marker,
1247 line, lineWidth, color) && !isAuto ) {
1249 c.R = color.red()/255.;
1250 c.G = color.green()/255.;
1251 c.B = color.blue()/255.;
1252 pCrv->SetColor( c );
1253 pCrv->SetMarker( ( VISU::Curve::MarkerType )marker );
1254 pCrv->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1256 pContainer->AddCurve( pCrv->_this() );
1260 UpdateObjBrowser(this);
1261 PlotContainer( this, pContainer, VISU::eDisplay );
1266 // if study is locked just get curves info and plot them
1267 QPtrList<Plot2d_Curve> container;
1268 dlg->getCurves( container );
1269 if ( !container.isEmpty() ) {
1270 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
1271 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( SOName );
1284 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1285 SALOME_ListIO aListIO;
1286 aSelectionMgr->selectedObjects(aListIO);
1287 if (aListIO.Extent() != 1) return;
1289 SalomeApp_Study* aAppStudy = GetAppStudy(this);
1290 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1291 CORBA::Object_var anObject = GetSelectedObj( aAppStudy, anIO->getEntry() );
1292 if (CORBA::is_nil( anObject )) return;
1294 VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
1295 if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TCURVE) {
1297 CORBA::Object_ptr aCurve = VISU::Curve::_narrow( anObject );
1298 if( !CORBA::is_nil( aCurve ) ) {
1299 VISU::Curve_i* aDSCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
1300 if ( aDSCurve && (!IsStudyLocked( GetCStudy(aAppStudy) )) ) {
1301 Plot2d_SetupCurveDlg aDlg(GetDesktop( this ));
1303 aDlg.setLine( (int)aDSCurve->GetLine(), aDSCurve->GetLineWidth() );
1304 aDlg.setMarker( (int)aDSCurve->GetMarker() );
1305 SALOMEDS::Color aColor = aDSCurve->GetColor();
1306 aDlg.setColor( QColor( (int)(aColor.R*255.), (int)(aColor.G*255.), (int)(aColor.B*255.) ) );
1307 if( aDlg.exec() == QDialog::Accepted ) {
1308 aDSCurve->SetLine( (VISU::Curve::LineType)aDlg.getLine(), aDlg.getLineWidth() );
1309 aDSCurve->SetMarker( (VISU::Curve::MarkerType)aDlg.getMarker());
1310 SALOMEDS::Color newColor;
1311 newColor.R = aDlg.getColor().red()/255.;
1312 newColor.G = aDlg.getColor().green()/255.;
1313 newColor.B = aDlg.getColor().blue()/255.;
1314 aDSCurve->SetColor( newColor );
1315 PlotCurve(this, aDSCurve, VISU::eDisplay);
1326 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1327 if (CheckLock(aCStudy,GetDesktop(this)))
1329 Handle(SALOME_InteractiveObject) anIO;
1330 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1331 if (anIO.IsNull() || CORBA::is_nil(anObject))
1334 VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
1335 if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TCONTAINER) {
1337 CORBA::Object_ptr aCnt = VISU::Container::_narrow(anObject);
1338 if (!CORBA::is_nil(aCnt)) {
1339 VISU::Container_i* container = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aCnt).in());
1340 if (container && container->GetNbCurves() > 0) {
1342 UpdateObjBrowser(this);
1352 Handle(SALOME_InteractiveObject) anIO;
1353 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1354 if (CORBA::is_nil(anObject)) return;
1356 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1357 if (!aServant.in()) return;
1358 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aServant.in());
1359 if (!aContainer) return;
1361 VisuGUI_EditContainerDlg* aDlg = new VisuGUI_EditContainerDlg (this);
1362 aDlg->initFromPrsObject(aContainer);
1364 aDlg->storeToPrsObject(aContainer);
1365 UpdateObjBrowser(this, true);
1374 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1375 if (CheckLock(aCStudy,GetDesktop(this)))
1378 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
1379 if (aViewMgr->getType() != SVTK_Viewer::Type())
1382 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1383 SALOME_ListIO aListIO;
1384 aSelectionMgr->selectedObjects(aListIO);
1385 if (aListIO.Extent() > 1)
1388 if (aListIO.Extent() == 0) {
1389 VISU::View3D_i::SaveViewParams(aViewMgr, VISU::View3D_i::GenerateViewParamsName().latin1());
1391 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1392 VISU::View3D_i::SaveViewParams(aViewMgr, anIO->getName());
1394 UpdateObjBrowser(this);
1399 OnRestoreViewParams()
1401 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
1402 if (aViewMgr->getType() != SVTK_Viewer::Type())
1405 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1406 SALOME_ListIO aListIO;
1407 aSelectionMgr->selectedObjects(aListIO);
1408 if (aListIO.Extent() != 1)
1411 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1412 //jfa tmp:VISU::View3D_i::RestoreViewParams(aViewMgr, anIO->getName());
1413 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));//jfa tmp
1414 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());//jfa tmp
1416 VISU::View3D_i::RestoreViewParams(aViewMgr, aSObj->GetName().c_str());//jfa tmp
1423 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1424 if (CheckLock(aCStudy,GetDesktop(this)))
1427 Handle(SALOME_InteractiveObject) anIO;
1428 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1430 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
1433 //TEST DU PARENT == VISU
1434 _PTR(StudyBuilder) aBuilder = aCStudy->NewBuilder();
1435 _PTR(GenericAttribute) anAttr = aBuilder->FindOrCreateAttribute(aSObj, "AttributeName");
1437 _PTR(AttributeName) aName (anAttr);
1438 QString Name = VisuGUI_NameDlg::getName( GetDesktop( this ), aName->Value().c_str() );
1439 if (!Name.isEmpty()) {
1440 QApplication::setOverrideCursor(Qt::waitCursor);
1442 // rename specific objects
1443 if (!CORBA::is_nil(anObject)) {
1444 VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
1445 if (!CORBA::is_nil(aVisuObj)) {
1446 switch (aVisuObj->GetType()) {
1447 case VISU::TCURVE: // Curve object
1449 CORBA::Object_ptr aCurve = VISU::Curve::_narrow(anObject);
1450 if (!CORBA::is_nil(aCurve)) {
1451 VISU::Curve_i* curve =
1452 dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
1454 curve->SetName(Name.latin1());
1458 case VISU::TTABLE: // Table object
1460 CORBA::Object_ptr aTable = VISU::Table::_narrow(anObject);
1461 if (!CORBA::is_nil(aTable)) {
1462 VISU::Table_i* table =
1463 dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTable).in());
1465 table->SetName(Name.latin1());
1469 case VISU::TCONTAINER: // Container object
1471 CORBA::Object_ptr aContainer = VISU::Container::_narrow(anObject);
1472 if (!CORBA::is_nil(aContainer)) {
1473 VISU::Container_i* container =
1474 dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
1476 container->SetName(Name.latin1());
1487 // rename the study object
1488 aName->SetValue(Name.latin1()); // rename the SObject
1489 anIO->setName(Name.latin1()); // rename the InteractiveObject
1491 ViewManagerList pvm_list;
1492 getApp()->viewManagers( SPlot2d_Viewer::Type(), pvm_list );
1493 for( SUIT_ViewManager* mgr = pvm_list.first(); mgr; mgr = pvm_list.next() )
1495 Plot2d_ViewManager* pvm = dynamic_cast<Plot2d_ViewManager*>( mgr );
1498 SPlot2d_Viewer* pv = dynamic_cast<SPlot2d_Viewer*>( pvm->getViewModel() );
1500 pv->renameAll( anIO, Name.latin1() );
1504 UpdateObjBrowser(this, false);
1506 QApplication::restoreOverrideCursor();
1515 new VisuGUI_ClippingDlg (this, "", false);
1523 Handle(SALOME_InteractiveObject) anIO;
1524 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1525 if (CORBA::is_nil(anObject)) return;
1526 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1527 if (!aServant.in()) return;
1529 VISU::ScalarMap_i* aPrsObject = dynamic_cast<VISU::ScalarMap_i*>(aServant.in());
1530 if (!aPrsObject) return;
1532 SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this);
1535 VISU_Actor* aActor = GetActor(aPrsObject, vw);
1536 if (!aActor) return;
1538 if (!aActor->GetVisibility()) {
1539 aActor->VisibilityOn();
1542 // Get sweep parameters
1543 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
1545 double aTempoDbl = aResourceMgr->doubleValue("VISU", "sweeping_time_step", 0.1);
1546 int aTemp = int(1.E6 * aTempoDbl);
1548 int aCycles = aResourceMgr->integerValue("VISU", "sweeping_number_cycles", 1);
1549 int aSteps = aResourceMgr->integerValue("VISU", "sweeping_time_step", 40);
1552 QApplication::setOverrideCursor(Qt::waitCursor);
1553 for (int j = 0; j < aCycles; j++) {
1554 for (int i = 0; i <= aSteps; i++) {
1556 float aPercents = float(i)/aSteps;
1557 aPrsObject->SetMapScale(aPercents);
1558 aPrsObject->UpdateActor(aActor);
1559 vw->getRenderWindow()->Render();
1561 } catch (std::exception& exc) {
1562 INFOS("Follow exception was occured :\n" << exc.what());
1564 INFOS("Unknown exception was occured!");
1568 QApplication::restoreOverrideCursor();
1575 if (!VISU::GetActiveViewWindow<SVTK_ViewWindow>(this))
1578 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1579 VisuGUI_TimeAnimationDlg* aAnimationDlg =
1580 new VisuGUI_TimeAnimationDlg (this, aCStudy);
1582 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1583 SALOME_ListIO aListIO;
1584 aSelectionMgr->selectedObjects(aListIO);
1586 bool isDefined = false;
1588 SALOME_ListIteratorOfListIO It (aListIO);
1589 for (; It.More(); It.Next()) {
1590 _PTR(SObject) aSObject = aCStudy->FindObjectID(It.Value()->getEntry());
1591 if (!aSObject) continue;
1592 if (getValue(aSObject, "myComment") == QString("FIELD")) {
1593 long aNumber = getValue(aSObject, "myNbTimeStamps").toLong();
1597 aAnimationDlg->addField(aSObject);
1599 } else if (aNbTimes == aNumber) {
1600 aAnimationDlg->addField(aSObject);
1605 if (isDefined) aAnimationDlg->show();
1606 else delete aAnimationDlg;
1609 //************************************************************************
1614 if (!VISU::GetActiveViewWindow<SVTK_ViewWindow>(this))
1617 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1618 SALOME_ListIO aListIO;
1619 aSelectionMgr->selectedObjects(aListIO);
1621 if (aListIO.Extent() != 1)
1624 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1626 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1628 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
1631 VISU::Storable::TRestoringMap aMap;
1632 _PTR(GenericAttribute) anAttr;
1633 if (!aSObj->FindAttribute(anAttr, "AttributeComment")) return;
1635 _PTR(AttributeComment) aComment (anAttr);
1636 string aComm = aComment->Value();
1637 QString strIn (aComm.c_str());
1638 VISU::Storable::StrToMap(strIn, aMap);
1640 VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
1641 if (aType != VISU::TANIMATION) return;
1643 VisuGUI_TimeAnimationDlg* aAnimationDlg =
1644 new VisuGUI_TimeAnimationDlg(this, aCStudy);
1645 aAnimationDlg->restoreFromStudy(aSObj);
1646 aAnimationDlg->show();
1651 OnCopyPresentation()
1653 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1654 if (CheckLock(aCStudy,GetDesktop(this)))
1657 Handle(SALOME_InteractiveObject) anIO;
1658 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1659 if (CORBA::is_nil(anObject)) return;
1660 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1661 if (!aServant.in()) return;
1663 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
1664 if (!aPrsObject) return;
1666 switch (aPrsObject->GetType()) {
1669 VISU::Mesh_i* aMeshPrs = dynamic_cast<VISU::Mesh_i*>(aPrsObject);
1670 VISU::Mesh_i* aSameMesh = new VISU::Mesh_i(aMeshPrs->GetResult());
1671 aSameMesh->SameAs(aMeshPrs);
1674 case VISU::TSCALARMAP:
1676 VISU::ScalarMap_i* aScalarPrs = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
1677 VISU::ScalarMap_i* aSameScalar = new VISU::ScalarMap_i(aScalarPrs->GetResult(),true);
1678 aSameScalar->SameAs(aScalarPrs);
1681 case VISU::TDEFORMEDSHAPE:
1683 VISU::DeformedShape_i* aDefPrs = dynamic_cast<VISU::DeformedShape_i*>(aPrsObject);
1684 VISU::DeformedShape_i* aSameDeformed = new VISU::DeformedShape_i(aDefPrs->GetResult(),true);
1685 aSameDeformed->SameAs(aDefPrs);
1688 case VISU::TSCALARMAPONDEFORMEDSHAPE:
1690 VISU::ScalarMapOnDeformedShape_i* aDefPrs =
1691 dynamic_cast<VISU::ScalarMapOnDeformedShape_i*>(aPrsObject);
1692 VISU::ScalarMapOnDeformedShape_i* aSameScalarMapOnDeformed =
1693 new VISU::ScalarMapOnDeformedShape_i(aDefPrs->GetResult(),true);
1694 aSameScalarMapOnDeformed->SameAs(aDefPrs);
1697 case VISU::TCUTPLANES:
1699 VISU::CutPlanes_i* aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
1700 VISU::CutPlanes_i* aSameCut = new VISU::CutPlanes_i(aCutPrs->GetResult(),true);
1701 aSameCut->SameAs(aCutPrs);
1704 case VISU::TCUTLINES:
1706 VISU::CutLines_i* aCutPrs = dynamic_cast<VISU::CutLines_i*>(aPrsObject);
1707 VISU::CutLines_i* aSameCut = new VISU::CutLines_i(aCutPrs->GetResult(),true);
1708 aSameCut->SameAs(aCutPrs);
1711 case VISU::TISOSURFACE:
1713 VISU::IsoSurfaces_i* aIsoPrs = dynamic_cast<VISU::IsoSurfaces_i*>(aPrsObject);
1714 VISU::IsoSurfaces_i* aSameIso = new VISU::IsoSurfaces_i(aIsoPrs->GetResult(),true);
1715 aSameIso->SameAs(aIsoPrs);
1718 case VISU::TSTREAMLINES:
1720 VISU::StreamLines_i* aLinesPrs = dynamic_cast<VISU::StreamLines_i*>(aPrsObject);
1721 VISU::StreamLines_i* aSameLines = new VISU::StreamLines_i(aLinesPrs->GetResult(),true);
1722 aSameLines->SameAs(aLinesPrs);
1725 case VISU::TVECTORS:
1727 VISU::Vectors_i* aVectorsPrs = dynamic_cast<VISU::Vectors_i*>(aPrsObject);
1728 VISU::Vectors_i* aSameVectors = new VISU::Vectors_i(aVectorsPrs->GetResult(),true);
1729 aSameVectors->SameAs(aVectorsPrs);
1734 VISU::Plot3D_i* aPlot3DPrs = dynamic_cast<VISU::Plot3D_i*>(aPrsObject);
1735 VISU::Plot3D_i* aSamePlot3D = new VISU::Plot3D_i(aPlot3DPrs->GetResult());
1736 aSamePlot3D->SameAs(aPlot3DPrs);
1740 UpdateObjBrowser(this);
1747 if (GetActiveViewWindow<SVTK_ViewWindow>(this))
1748 (new VisuGUI_SelectionDlg(this))->show();
1750 SUIT_MessageBox::warn1(GetDesktop(this),
1752 tr("ERR_ACTIVATE_VIEW3D"),
1760 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1761 SALOME_ListIO aListIO;
1762 aSelectionMgr->selectedObjects(aListIO);
1764 SALOME_ListIteratorOfListIO It (aListIO);
1766 // first find the bounds
1767 double aMin, aMax; bool first = true;
1768 for (; It.More(); It.Next()) {
1769 Handle(SALOME_InteractiveObject)& anIO = It.Value();
1770 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
1771 if (!aPrsList.empty()) {
1772 for (int i = 0, n = aPrsList.size(); i < n; i++) {
1773 VISU::Prs3d_i* aPrsObject = aPrsList[i];
1775 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
1779 aMin = aScalar->GetMin(); aMax = aScalar->GetMax();
1781 if (aScalar->GetMin() < aMin) aMin = aScalar->GetMin();
1782 if (aScalar->GetMax() > aMax) aMax = aScalar->GetMax();
1790 // set the computed range to every selected ScalarMap
1791 bool update = false;
1792 for (It.Initialize(aListIO); It.More(); It.Next() ) {
1793 Handle(SALOME_InteractiveObject)& anIO = It.Value();
1794 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
1795 if (!aPrsList.empty()) {
1796 for (int i = 0, n = aPrsList.size(); i < n; i++) {
1797 VISU::Prs3d_i* aPrsObject = aPrsList[i];
1799 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
1801 aScalar->SetRange(aMin, aMax);
1802 RecreateActor(this, aScalar);
1810 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
1811 vw->getRenderer()->ResetCameraClippingRange();
1821 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1822 SALOME_ListIO aListIO;
1823 aSelectionMgr->selectedObjects(aListIO);
1825 SALOME_ListIteratorOfListIO It (aListIO);
1827 // restore the source range for every ScalarMap
1828 bool update = false;
1829 for (; It.More(); It.Next()) {
1830 Handle(SALOME_InteractiveObject)& anIO = It.Value();
1831 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
1832 if (!aPrsList.empty()) {
1833 for (int i = 0, n = aPrsList.size(); i < n; i++) {
1834 VISU::Prs3d_i* aPrsObject = aPrsList[i];
1836 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
1838 aScalar->SetSourceRange();
1839 RecreateActor(this, aScalar);
1847 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
1848 vw->getRenderer()->ResetCameraClippingRange();
1858 if(MYDEBUG) MESSAGE("VisuGUI::OnTranslatePrs");
1859 VisuGUI_OffsetDlg* aDlg = new VisuGUI_OffsetDlg (this);
1861 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1863 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1864 SALOME_ListIO aListIO;
1865 aSelectionMgr->selectedObjects(aListIO);
1867 SALOME_ListIteratorOfListIO It (aListIO);
1868 for (; It.More(); It.Next()) {
1869 Handle(SALOME_InteractiveObject)& anIO = It.Value();
1870 if (anIO->hasEntry()) {
1871 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
1873 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSObject);
1874 if (!CORBA::is_nil(aCORBAObject)) {
1875 PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
1876 if (VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in())) {
1877 aDlg->addPresentation(aPrsObject);
1883 if (aDlg->getPrsCount() > 0)
1893 SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this);
1895 ArrangeDlg* aDlg = new ArrangeDlg (GetDesktop(this), vw);
1904 initialize( CAM_Application* theApp )
1906 SalomeApp_Module::initialize( theApp );
1919 QWidget* aParent = application()->desktop();
1920 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
1923 createAction( VISU_IMPORT_FROM_FILE, "", QIconSet(),
1924 tr("MEN_IMPORT_FROM_FILE"), "", (CTRL + Key_I), aParent, false,
1925 this, SLOT(OnImportFromFile()));
1927 createAction( VISU_IMPORT_TABLE, "", QIconSet(),
1928 tr("MEN_IMPORT_TABLE"), "", 0, aParent, false,
1929 this, SLOT(OnImportTableFromFile()));
1931 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP"));
1932 createAction( VISU_SCALAR_MAP, tr("MEN_SCALAR_MAP"), QIconSet(aPixmap),
1933 tr("MEN_SCALAR_MAP"), "", 0, aParent, false,
1934 this, SLOT(OnCreateScalarMap()));
1936 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_DEFORMED_SHAPE"));
1937 createAction( VISU_DEFORMED_SHAPE, tr("MEN_DEFORMED_SHAPE"), QIconSet(aPixmap),
1938 tr("MEN_DEFORMED_SHAPE"), "", 0, aParent, false,
1939 this, SLOT(OnCreateDeformedShape()));
1941 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP_ON_DEFORMED_SHAPE"));
1942 createAction( VISU_SCALAR_MAP_ON_DEFORMED_SHAPE, tr("MEN_SCALAR_MAP_ON_DEFORMED_SHAPE"), QIconSet(aPixmap),
1943 tr("MEN_SCALAR_MAP_ON_DEFORMED_SHAPE"), "", 0, aParent, false,
1944 this, SLOT(OnCreateScalarMapOnDeformedShape()));
1946 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_VECTORS"));
1947 createAction( VISU_VECTORS, tr("MEN_VECTORS"), QIconSet(aPixmap),
1948 tr("MEN_VECTORS"), "", 0, aParent, false,
1949 this, SLOT(OnCreateVectors()));
1951 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ISO_SURFACES"));
1952 createAction( VISU_ISO_SURFACES, tr("MEN_ISO_SURFACES"), QIconSet(aPixmap),
1953 tr("MEN_ISO_SURFACES"), "", 0, aParent, false,
1954 this, SLOT(OnCreateIsoSurfaces()));
1956 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_PLANES"));
1957 createAction( VISU_CUT_PLANES, tr("MEN_CUT_PLANES"), QIconSet(aPixmap),
1958 tr("MEN_CUT_PLANES"), "", 0, aParent, false,
1959 this, SLOT(OnCreateCutPlanes()));
1961 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_STREAM_LINES"));
1962 createAction( VISU_STREAM_LINES, tr("MEN_STREAM_LINES"), QIconSet(aPixmap),
1963 tr("MEN_STREAM_LINES"), "", 0, aParent, false,
1964 this, SLOT(OnCreateStreamLines()));
1966 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_LINES"));
1967 createAction( VISU_CUT_LINES, tr("MEN_CUT_LINES"), QIconSet(aPixmap),
1968 tr("MEN_CUT_LINES"), "", 0, aParent, false,
1969 this, SLOT(OnCreateCutLines()));
1971 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT_3D"));
1972 createAction( VISU_PLOT_3D, tr("MEN_PLOT_3D"), QIconSet(aPixmap),
1973 tr("MEN_PLOT_3D"), "", 0, aParent, false,
1974 this, SLOT(OnCreatePlot3D()));
1976 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT2D"));
1977 createAction( VISU_PLOT2D, tr("MEN_CREATE_PLOT2D"), QIconSet(aPixmap),
1978 tr("MEN_CREATE_PLOT2D"), "", 0, aParent, false,
1979 this, SLOT(OnCreatePlot2dView()));
1981 createAction( VISU_DELETE_OBJS, tr("MEN_DELETE_OBJS"), QIconSet(),
1982 tr("MEN_DELETE_OBJS"), "", 0, aParent, false,
1983 this, SLOT(OnDeleteObjects()));
1985 createAction( VISU_SHOW_TABLE, tr("MEN_SHOW_TABLE"), QIconSet(),
1986 tr("MEN_SHOW_TABLE"), "", 0, aParent, false,
1987 this, SLOT(OnShowTable()));
1989 createAction( VISU_CREATE_CURVES, tr("MEN_CREATE_CURVES"), QIconSet(),
1990 tr("MEN_CREATE_CURVES"), "", 0, aParent, false,
1991 this, SLOT(OnPlotData()));
1993 createAction( VISU_EXPORT_TABLE, tr("MEN_EXPORT_TABLE"), QIconSet(),
1994 tr("MEN_EXPORT_TABLE"), "", 0, aParent, false,
1995 this, SLOT(OnExportTableToFile()));
1997 createAction( VISU_IMPORT_MED_STRUCTURE, tr("MEN_IMPORT_MED_STRUCTURE"), QIconSet(),
1998 tr("MEN_IMPORT_MED_STRUCTURE"), "", 0, aParent, false,
1999 this, SLOT(OnImportMedField()));
2001 createAction( VISU_IMPORT_MED_TIMESTAMP, tr("MEN_IMPORT_MED_TIMESTAMP"), QIconSet(),
2002 tr("MEN_IMPORT_MED_TIMESTAMP"), "", 0, aParent, false,
2003 this, SLOT(OnImportMedField()));
2005 createAction( VISU_IMPORT_MED_FIELD, tr("MEN_IMPORT_MED_FIELD"), QIconSet(),
2006 tr("MEN_IMPORT_MED_FIELD"), "", 0, aParent, false,
2007 this, SLOT(OnImportMedField()));
2009 createAction( VISU_CREATE_PRS, tr("MEN_CREATE_PRS"), QIconSet(),
2010 tr("MEN_CREATE_PRS"), "", 0, aParent, false,
2011 this, SLOT(OnCreateMesh()));
2013 createAction( VISU_CREATE_MANY_PRS, tr("MEN_CREATE_MANY_PRS"), QIconSet(),
2014 tr("MEN_CREATE_MANY_PRS"), "", 0, aParent, false,
2015 this, SLOT(OnCreateManyMesh()));
2017 createAction( VISU_TRANSLATE_PRS, tr("MEN_TRANSLATE_PRS"), QIconSet(),
2018 tr("MEN_TRANSLATE_PRS"), "", 0, aParent, false,
2019 this, SLOT(OnTranslatePrs()));
2021 createAction( VISU_MERGE_SCALAR_BARS, tr("MEN_MERGE_SCALAR_BARS"), QIconSet(),
2022 tr("MEN_MERGE_SCALAR_BARS"), "", 0, aParent, false,
2023 this, SLOT(OnMergeScalarBars()));
2025 createAction( VISU_FREE_SCALAR_BARS, tr("MEN_FREE_SCALAR_BARS"), QIconSet(),
2026 tr("MEN_FREE_SCALAR_BARS"), "", 0, aParent, false,
2027 this, SLOT(OnFreeScalarBars()));
2029 createAction( VISU_ERASE, tr("MEN_ERASE"), QIconSet(),
2030 tr("MEN_ERASE"), "", 0, aParent, false,
2031 this, SLOT(OnErasePrs()));
2033 createAction( VISU_DISPLAY, tr("MEN_DISPLAY"), QIconSet(),
2034 tr("MEN_DISPLAY"), "", 0, aParent, false,
2035 this, SLOT(OnDisplayPrs()));
2037 createAction( VISU_DISPLAY_ONLY, tr("MEN_DISPLAY_ONLY"), QIconSet(),
2038 tr("MEN_DISPLAY_ONLY"), "", 0, aParent, false,
2039 this, SLOT(OnDisplayOnlyPrs()));
2041 createAction( VISU_COPY_PRS, tr("MEN_COPY_PRS"), QIconSet(),
2042 tr("MEN_COPY_PRS"), "", 0, aParent, false,
2043 this, SLOT(OnCopyPresentation()));
2045 createAction( VISU_CURVE_PROPS, tr("MEN_CURVE_PROPS"), QIconSet(),
2046 tr("MEN_CURVE_PROPS"), "", 0, aParent, false,
2047 this, SLOT(OnCurveProperties()));
2049 createAction( VISU_RENAME, tr("MEN_RENAME"), QIconSet(), tr("MEN_RENAME"), "", 0, aParent, false,
2050 this, SLOT(OnRename()));
2052 createAction( VISU_EDIT_CONTAINER, tr("MEN_EDIT_CONTAINER"), QIconSet(),
2053 tr("MEN_EDIT_CONTAINER"), "", 0, aParent, false,
2054 this, SLOT(OnEditContainer()));
2056 createAction( VISU_CLEAR_CONTAINER, tr("MEN_CLEAR_CONTAINER"), QIconSet(),
2057 tr("MEN_CLEAR_CONTAINER"), "", 0, aParent, false,
2058 this, SLOT(OnClearContainer()));
2060 createAction( VISU_SAVE_VIEW_PARAMS, tr("MEN_SAVE_VIEWPARAMS"), QIconSet(),
2061 tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
2062 this, SLOT(OnSaveViewParams()));
2063 createAction( VISU_SAVE_VIEW_PARAMS_1, tr("MEN_SAVE_VIEWPARAMS"), QIconSet(),
2064 tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
2065 this, SLOT(OnSaveViewParams()));
2067 createAction( VISU_RESTORE_VIEW_PARAMS, tr("MEN_RESTORE_VIEWPARAMS"), QIconSet(),
2068 tr("MEN_RESTORE_VIEWPARAMS"), "", 0, aParent, false,
2069 this, SLOT(OnRestoreViewParams()));
2071 //createAction( VISU_DELETE_VIEW_PARAMS, tr("MEN_DELETE_VIEWPARAMS"), QIconSet(),
2072 // tr("MEN_DELETE_VIEWPARAMS"), "", 0, aParent, false,
2073 // this, SLOT(OnDeleteObjects()));
2075 createAction( VISU_ARRANGE_ACTORS, tr("MEN_ARRANGE_ACTORS"), QIconSet(),
2076 tr("MEN_ARRANGE_ACTORS"), "", 0, aParent, false,
2077 this, SLOT(OnArrangeActors()));
2079 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_POINTS"));
2080 createAction( VISU_POINTS, tr("MEN_POINTS"), QIconSet(aPixmap),
2081 tr("MEN_POINTS"), "", 0, aParent, false,
2082 this, SLOT(OnMakePoints()));
2084 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_WIREFRAME"));
2085 createAction( VISU_WIREFRAME, tr("MEN_WIREFRAME"), QIconSet(aPixmap),
2086 tr("MEN_WIREFRAME"), "", 0, aParent, false,
2087 this, SLOT(OnMakeWireframe()));
2089 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SURFACE"));
2090 createAction( VISU_SURFACE, tr("MEN_SURFACE"), QIconSet(aPixmap),
2091 tr("MEN_SURFACE"), "", 0, aParent, false,
2092 this, SLOT(OnMakeSurface()));
2094 createAction( VISU_INSIDEFRAME, tr("MEN_INSIDEFRAME"), QIconSet(),
2095 tr("MEN_INSIDEFRAME"), "", 0, aParent, false,
2096 this, SLOT(OnMakeInsideframe()));
2098 createAction( VISU_SURFACEFRAME, tr("MEN_SURFACEFRAME"), QIconSet(),
2099 tr("MEN_SURFACEFRAME"), "", 0, aParent, false,
2100 this, SLOT(OnMakeSurfaceframe()));
2102 createAction( VISU_SHRINK, tr("MEN_SHRINK"), QIconSet(),
2103 tr("MEN_SHRINK"), "", 0, aParent, false,
2104 this, SLOT(OnMakeShrink()));
2106 createAction( VISU_UNSHRINK, tr("MEN_UNSHRINK"), QIconSet(),
2107 tr("MEN_UNSHRINK"), "", 0, aParent, false,
2108 this, SLOT(OnMakeShrink()));
2110 createAction( VISU_SHADING, tr("MEN_SHADING"), QIconSet(),
2111 tr("MEN_SHADING"), "", 0, aParent, false,
2112 this, SLOT(OnSetShadingOn()));
2114 createAction( VISU_NOSHADING, tr("MEN_NOSHADING"), QIconSet(),
2115 tr("MEN_NOSHADING"), "", 0, aParent, false,
2116 this, SLOT(OnSetShadingOff()));
2118 createAction( VISU_CELL_COLOR, tr("MEN_CELL_COLOR"), QIconSet(),
2119 tr("MEN_CELL_COLOR"), "", 0, aParent, false,
2120 this, SLOT(OnChangeColor()));
2122 createAction( VISU_COLOR, tr("MEN_COLOR"), QIconSet(),
2123 tr("MEN_COLOR"), "", 0, aParent, false,
2124 this, SLOT(OnChangeColor()));
2126 createAction( VISU_EDGE_COLOR, tr("MEN_EDGE_COLOR"), QIconSet(),
2127 tr("MEN_EDGE_COLOR"), "", 0, aParent, false,
2128 this, SLOT(OnChangeWireframeColor()));
2130 createAction( VISU_OPACITY, tr("MEN_OPACITY"), QIconSet(),
2131 tr("MEN_OPACITY"), "", 0, aParent, false,
2132 this, SLOT(OnChangeOpacity()));
2134 createAction( VISU_LINE_WIDTH, tr("MEN_LINE_WIDTH"), QIconSet(),
2135 tr("MEN_LINE_WIDTH"), "", 0, aParent, false,
2136 this, SLOT(OnChangeLines()));
2139 createAction( VISU_EDIT_SCALARMAP, tr("MEN_EDIT_PRS"), QIconSet(),
2140 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2141 this, SLOT(OnEditScalarMap()));
2143 createAction( VISU_EDIT_DEFORMEDSHAPE, tr("MEN_EDIT_PRS"), QIconSet(),
2144 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2145 this, SLOT(OnEditDeformedShape()));
2147 createAction( VISU_EDIT_CUTPLANES, tr("MEN_EDIT_PRS"), QIconSet(),
2148 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2149 this, SLOT(OnEditCutPlanes()));
2151 createAction( VISU_EDIT_CUTLINES, tr("MEN_EDIT_PRS"), QIconSet(),
2152 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2153 this, SLOT(OnEditCutLines()));
2155 createAction( VISU_EDIT_ISOSURFACE, tr("MEN_EDIT_PRS"), QIconSet(),
2156 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2157 this, SLOT(OnEditIsoSurfaces()));
2159 createAction( VISU_EDIT_VECTORS, tr("MEN_EDIT_PRS"), QIconSet(),
2160 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2161 this, SLOT(OnEditVectors()));
2163 createAction( VISU_EDIT_STREAMLINES, tr("MEN_EDIT_PRS"), QIconSet(),
2164 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2165 this, SLOT(OnEditStreamLines()));
2167 createAction( VISU_EDIT_PLOT3D, tr("MEN_EDIT_PRS"), QIconSet(),
2168 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2169 this, SLOT(OnEditPlot3D()));
2171 createAction( VISU_EDIT_SCALARMAPONDEFORMEDSHAPE, tr("MEN_EDIT_PRS"), QIconSet(),
2172 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2173 this, SLOT(OnEditScalarMapOnDeformedShape()));
2176 createAction( VISU_CREATE_TABLE, tr("MEN_CREATE_TABLE"), QIconSet(),
2177 tr("MEN_CREATE_TABLE"), "", 0, aParent, false,
2178 this, SLOT(OnCreateTable()));
2180 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SWEEP"));
2181 createAction( VISU_SWEEP, tr("MEN_SWEEP"), QIconSet(aPixmap),
2182 tr("MEN_SWEEP"), "", 0, aParent, false,
2183 this, SLOT(OnSweep()));
2185 createAction( VISU_CLIPPING, tr("MEN_CLIPPING"), QIconSet(),
2186 tr("MEN_CLIPPING"), "", 0, aParent, false,
2187 this, SLOT(OnClippingPlanes()));
2189 createAction( VISU_SELECTION_INFO, tr("MEN_SELECTION_INFO"), QIconSet(),
2190 tr("MEN_SELECTION_INFO"), "", 0, aParent, false,
2191 this, SLOT(OnSelectionInfo()));
2193 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_TIMEANIMATION"));
2194 createAction( VISU_ANIMATION, tr("MEN_ANIMATION"), QIconSet(aPixmap),
2195 tr("MEN_ANIMATION"), "", 0, aParent, false,
2196 this, SLOT(OnTimeAnimation()));
2198 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ERASE_ALL"));
2199 createAction( VISU_ERASE_ALL, tr("MEN_ERASE_ALL"), QIconSet(aPixmap),
2200 tr("MEN_ERASE_ALL"), "", 0, aParent, false,
2201 this, SLOT(OnEraseAll()));
2203 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_GLOBAL_SELECTION"));
2204 createAction( VISU_GLOBAL_SELECTION, tr("MEN_GLOBAL_SELECTION"), QIconSet(aPixmap),
2205 tr("MEN_GLOBAL_SELECTION"), "", 0, aParent, false,
2208 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PARTIAL_SELECTION"));
2209 createAction( VISU_PARTIAL_SELECTION, tr("MEN_PARTIAL_SELECTION"), QIconSet(aPixmap),
2210 tr("MEN_PARTIAL_SELECTION"), "", 0, aParent, false,
2213 createAction( VISU_SHOW_ANIMATION, tr("MEN_SHOW_ANIMATION"), QIconSet(),
2214 tr("MEN_SHOW_ANIMATION"), "", 0, aParent, false,
2215 this, SLOT(OnShowAnimation()));
2222 // Add actions to menus
2224 aMenuId = createMenu( tr( "MEN_DESK_FILE" ), -1 );
2225 createMenu( separator(), aMenuId, -1, 10 );
2227 int anImportId = createMenu( tr( "MEN_IMPORT" ), aMenuId, -1, 10 );
2228 createMenu( VISU_IMPORT_FROM_FILE, anImportId ); // import from file
2229 createMenu( VISU_IMPORT_TABLE, anImportId ); // import table
2231 aMenuId = createMenu( tr( "MEN_VISUALIZATION" ), -1, -1, 30 );
2232 createMenu( VISU_SCALAR_MAP, aMenuId, 10 ); // scalar map
2233 createMenu( VISU_DEFORMED_SHAPE, aMenuId, 10 ); // deformed shape
2234 createMenu( VISU_VECTORS, aMenuId, 10 ); // vectors
2235 createMenu( VISU_ISO_SURFACES, aMenuId, 10 ); // iso surfaces
2236 createMenu( VISU_CUT_PLANES, aMenuId, 10 ); // cut planes
2237 createMenu( VISU_CUT_LINES, aMenuId, 10 ); // cut lines
2238 createMenu( VISU_STREAM_LINES, aMenuId, 10 ); // stream lines
2239 createMenu( VISU_PLOT_3D, aMenuId, 10 ); // Plot3d
2240 createMenu( VISU_SCALAR_MAP_ON_DEFORMED_SHAPE, aMenuId, 10 ); // scalar map on deformed shape
2242 aMenuId = createMenu( tr( "MEN_SELECTION" ), -1, -1, 30 );
2243 createMenu( VISU_SELECTION_INFO, aMenuId, 10 ); // selection info
2245 aMenuId = createMenu( tr( "MEN_REPRESENTATION" ), -1, -1, 30 );
2247 createMenu( tr( "MEN_DISPLAY_SELECTION" ), aMenuId, 10 ); // display selection
2248 createMenu( VISU_POINTS, parentId, 10 ); // points
2249 createMenu( VISU_WIREFRAME, parentId, 10 ); // wireframe
2250 createMenu( VISU_SURFACE, parentId, 10 ); // surface
2251 createMenu( VISU_ERASE_ALL, aMenuId, 10 ); // erase all
2252 createMenu( VISU_GLOBAL_SELECTION, aMenuId, 10 ); // global selection
2253 createMenu( VISU_PARTIAL_SELECTION, aMenuId, 10 ); // partial selection
2260 int aToolId = createTool(tr("TOOL_VISUALISATION"));
2261 createTool( VISU_SCALAR_MAP, aToolId );
2262 createTool( VISU_DEFORMED_SHAPE, aToolId );
2263 createTool( VISU_VECTORS, aToolId );
2264 createTool( VISU_ISO_SURFACES, aToolId );
2265 createTool( VISU_CUT_PLANES, aToolId );
2266 createTool( VISU_CUT_LINES, aToolId );
2267 createTool( VISU_STREAM_LINES, aToolId );
2268 createTool( VISU_PLOT_3D, aToolId );
2269 createTool( VISU_SCALAR_MAP_ON_DEFORMED_SHAPE, aToolId );
2271 aToolId = createTool(tr("TOOL_REPRESENTATION"));
2272 createTool( VISU_POINTS, aToolId );
2273 createTool( VISU_WIREFRAME, aToolId );
2274 createTool( VISU_SURFACE, aToolId );
2275 createTool( VISU_ERASE_ALL, aToolId );
2276 createTool( VISU_GLOBAL_SELECTION, aToolId );
2277 createTool( VISU_PARTIAL_SELECTION, aToolId );
2284 // Prepare popup menus
2285 QtxPopupMgr* mgr = popupMgr();
2287 // VISU root commands
2288 mgr->insert( action( VISU_IMPORT_FROM_FILE ), -1, -1, -1 ); // import MED file
2289 mgr->insert( action( VISU_IMPORT_TABLE ), -1, -1, -1 ); // import tables from file
2290 mgr->insert( action( VISU_PLOT2D ), -1, -1, -1 ); // create Plot2d View
2292 //mgr->insert( action( VISU_IMPORT_MED ), -1, -1, -1 ); // import MED structure from MED module
2295 mgr->insert( action( VISU_SCALAR_MAP ), -1, -1, -1 ); // scalar bar
2296 mgr->insert( action( VISU_ISO_SURFACES ), -1, -1, -1 ); // iso surface
2297 mgr->insert( action( VISU_CUT_PLANES ), -1, -1, -1 ); // cut planes
2298 mgr->insert( action( VISU_CUT_LINES ), -1, -1, -1 ); // cut lines
2299 mgr->insert( action( VISU_DEFORMED_SHAPE ), -1, -1, -1 ); // deformed shape
2300 mgr->insert( action( VISU_VECTORS ), -1, -1, -1 ); // vectors
2301 mgr->insert( action( VISU_STREAM_LINES ), -1, -1, -1 ); // stream lines
2302 mgr->insert( action( VISU_PLOT_3D ), -1, -1, -1 ); // Plot3d
2303 mgr->insert( action( VISU_SCALAR_MAP_ON_DEFORMED_SHAPE ), -1, -1, -1 ); // scalar map on deformed shape
2305 mgr->insert( action( VISU_CREATE_PRS ), -1, -1, -1 ); // create presentation
2306 mgr->insert( action( VISU_CREATE_MANY_PRS ), -1, -1, -1 ); // create presentations
2308 mgr->insert( action( VISU_CREATE_TABLE ), -1, -1, -1 ); // create table
2311 mgr->insert( action( VISU_EDIT_SCALARMAP ), -1, -1, -1 );
2312 mgr->insert( action( VISU_EDIT_DEFORMEDSHAPE ), -1, -1, -1 );
2313 mgr->insert( action( VISU_EDIT_CUTPLANES ), -1, -1, -1 );
2314 mgr->insert( action( VISU_EDIT_CUTLINES ), -1, -1, -1 );
2315 mgr->insert( action( VISU_EDIT_ISOSURFACE ), -1, -1, -1 );
2316 mgr->insert( action( VISU_EDIT_VECTORS ), -1, -1, -1 );
2317 mgr->insert( action( VISU_EDIT_STREAMLINES ), -1, -1, -1 );
2318 mgr->insert( action( VISU_EDIT_PLOT3D ), -1, -1, -1 );
2319 mgr->insert( action( VISU_EDIT_SCALARMAPONDEFORMEDSHAPE ), -1, -1, -1 );
2320 mgr->insert( action( VISU_EDIT_CONTAINER ), -1, -1, -1 );
2323 mgr->insert( action( VISU_RENAME ), -1, -1, -1 );
2326 mgr->insert( action( VISU_COPY_PRS ), -1, -1, -1 );
2329 mgr->insert( action( VISU_CLEAR_CONTAINER ), -1, -1, -1 );
2332 //mgr->insert( action( VISU_SHOW_TABLE ), -1, -1, -1 ); // show table
2333 //mgr->insert( action( VISU_CREATE_CURVES ), -1, -1, -1 ); // create curves
2334 //mgr->insert( action( VISU_EXPORT_TABLE ), -1, -1, -1 ); // export table
2336 mgr->insert( separator(), -1, -1, -1 );
2338 mgr->insert( action( VISU_ERASE ), -1, -1, -1 ); // erase
2339 mgr->insert( action( VISU_DISPLAY ), -1, -1, -1 ); // display
2340 mgr->insert( action( VISU_DISPLAY_ONLY ), -1, -1, -1 ); // display only
2342 // "Representation" submenu
2343 int parentId = mgr->insert( tr( "MEN_REPRESENTATION" ), -1, -1 );
2344 mgr->insert( action( VISU_POINTS ) , parentId, -1, -1 ); // points
2345 mgr->insert( action( VISU_WIREFRAME ) , parentId, -1, -1 ); // wireframe
2346 mgr->insert( action( VISU_SURFACE ) , parentId, -1, -1 ); // surface
2347 mgr->insert( action( VISU_INSIDEFRAME ) , parentId, -1, -1 ); // insideframe
2348 mgr->insert( action( VISU_SURFACEFRAME ), parentId, -1, -1 ); // surfaceframe
2349 mgr->insert( action( VISU_SHRINK ) , parentId, -1, -1 ); // shrink
2350 mgr->insert( action( VISU_UNSHRINK ) , parentId, -1, -1 ); // unshrink
2351 mgr->insert( separator(), parentId, -1, -1 );
2352 mgr->insert( action( VISU_SHADING ) , parentId, -1, -1 ); // shading
2353 mgr->insert( action( VISU_NOSHADING ) , parentId, -1, -1 ); // noshading
2355 // "Properties" submenu
2356 parentId = mgr->insert( tr( "MEN_PROPERTIES" ), -1, -1 );
2357 mgr->insert( action( VISU_CELL_COLOR ), parentId, -1, -1 ); // cell color
2358 mgr->insert( action( VISU_EDGE_COLOR ), parentId, -1, -1 ); // edge color
2359 mgr->insert( action( VISU_COLOR ) , parentId, -1, -1 ); // color
2360 mgr->insert( action( VISU_OPACITY ) , parentId, -1, -1 ); // opacity
2361 mgr->insert( action( VISU_LINE_WIDTH ), parentId, -1, -1 ); // line width
2363 mgr->insert( separator(), -1, -1, -1 );
2365 // Other presentations management
2366 mgr->insert( action( VISU_TRANSLATE_PRS ), -1, -1, -1 );
2367 mgr->insert( action( VISU_CLIPPING ), -1, -1, -1 );
2369 mgr->insert( action( VISU_MERGE_SCALAR_BARS ), -1, -1, -1 );
2370 mgr->insert( action( VISU_FREE_SCALAR_BARS ), -1, -1, -1 );
2372 mgr->insert( action( VISU_SWEEP ), -1, -1, -1 );
2373 mgr->insert( action( VISU_ANIMATION ), -1, -1, -1 );
2375 mgr->insert( separator(), -1, -1, -1 );
2377 // view parameters commands
2378 mgr->insert( action( VISU_SAVE_VIEW_PARAMS ), -1, -1, -1 ); // save view params
2379 mgr->insert( action( VISU_SAVE_VIEW_PARAMS_1 ), -1, -1, -1 ); // save view params
2380 mgr->insert( action( VISU_RESTORE_VIEW_PARAMS ), -1, -1, -1 ); // restore view params
2381 //mgr->insert( action( VISU_DELETE_VIEW_PARAMS ), -1, -1, -1 ); // delete view params
2383 mgr->insert( action( VISU_ARRANGE_ACTORS ), -1, -1, -1 ); // arrange actors
2385 mgr->insert( action( VISU_CURVE_PROPS ), -1, -1, -1 ); // curve properties
2387 mgr->insert( action( VISU_SELECTION_INFO ), -1, -1, -1 ); // Selection info
2391 QString aPrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
2392 "'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE'");
2394 // VISU root commands
2395 QString aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TVISUGEN'";
2396 mgr->setRule( action( VISU_IMPORT_FROM_FILE ), aRule, true );
2397 mgr->setRule( action( VISU_IMPORT_TABLE ), aRule, true );
2398 mgr->setRule( action( VISU_PLOT2D ), aRule, true );
2400 // timestamp commands
2401 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TTIMESTAMP'";
2402 mgr->setRule( action( VISU_SCALAR_MAP ), aRule, true );
2403 mgr->setRule( action( VISU_ISO_SURFACES ), aRule, true );
2404 mgr->setRule( action( VISU_CUT_PLANES ), aRule, true );
2405 mgr->setRule( action( VISU_CUT_LINES ), aRule, true );
2406 mgr->setRule( action( VISU_PLOT_3D ), aRule, true );
2407 aRule += " and nbComponents>1";
2408 mgr->setRule( action( VISU_DEFORMED_SHAPE ), aRule, true );
2409 mgr->setRule( action( VISU_VECTORS ), aRule, true );
2410 mgr->setRule( action( VISU_STREAM_LINES ), aRule, true );
2411 mgr->setRule( action( VISU_SCALAR_MAP_ON_DEFORMED_SHAPE ), aRule, true );
2413 // display/erase commands
2414 QString andInvisible = " and (((not isVisible) and isActiveView) or (not isActiveView))";
2415 QString aTableOrCont = "(type='VISU::TTABLE' and nbChildren>0) or type='VISU::TCONTAINER'";
2416 QString orCurveVisible = "or (type='VISU::TCURVE' and isVisible)";
2417 QString orCurveInvisible = "or (type='VISU::TCURVE'" + andInvisible + ")";
2418 QString aPrsVisible = "(($type in {'VISU::TMESH' " + aPrsAll + "}) and isVisible)";
2419 QString aPrsInvisible = "(($type in {'VISU::TMESH' " + aPrsAll + "})" + andInvisible + ")";
2420 QString aComponent = "( selcount=1 and canBeDisplayed and isComponent )";
2422 QString anEraseRule = "( selcount>0 and ({true} in $canBeDisplayed) and (" + aPrsVisible +
2423 " or (client='ObjectBrowser' and (" + aTableOrCont + orCurveVisible + "))) ) or " + aComponent;
2425 QString aDisplayRule = "( selcount>0 and ({true} in $canBeDisplayed) and (" + aPrsInvisible +
2426 " or (client='ObjectBrowser' and (" + aTableOrCont + orCurveInvisible + "))) ) or" + aComponent;
2428 QString aDOnlyRule = "( selcount>0 and ({true} in $canBeDisplayed) and (($type in {'VISU::TMESH' " + aPrsAll + "})"
2429 " or (client='ObjectBrowser' and ((type='VISU::TTABLE' and nbChildren>0) or"
2430 " ($type in {'VISU::TCURVE' 'VISU::TCONTAINER'})))) ) or" + aComponent;
2432 mgr->setRule( action( VISU_ERASE ), anEraseRule, true );
2433 mgr->setRule( action( VISU_DISPLAY ), aDisplayRule, true );
2434 mgr->setRule( action( VISU_DISPLAY_ONLY ), aDOnlyRule, true );
2436 aRule = "selcount>0 and $type in {'VISU::TMESH' " + aPrsAll + "}";
2437 mgr->setRule( action( VISU_TRANSLATE_PRS ), aRule, true );
2439 aRule = "selcount>1 and $type in {'VISU::TMESH' " + aPrsAll + "}";
2440 mgr->setRule( action( VISU_MERGE_SCALAR_BARS ), aRule, true );
2441 mgr->setRule( action( VISU_FREE_SCALAR_BARS ), aRule, true );
2444 aRule = "selcount=1 and type='VISU::TVIEW3D' and activeView='VTKViewer'";
2445 mgr->setRule( action( VISU_SAVE_VIEW_PARAMS_1 ), aRule, true );
2446 mgr->setRule( action( VISU_SAVE_VIEW_PARAMS ), "client='VTKViewer' and selcount=0 and activeView='VTKViewer'", true );
2447 mgr->setRule( action( VISU_RESTORE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D' and activeView='VTKViewer'", true );
2448 //mgr->setRule( action( VISU_DELETE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D'", true );
2450 mgr->setRule( action( VISU_ARRANGE_ACTORS ), "client='VTKViewer' and selcount=0", true );
2452 // 3D presentations commands
2453 QString aPrsType = " and $type in {'VISU::TMESH' " + aPrsAll + "}";
2454 QString aInsideType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE'}";
2455 QString aSurfType = " and $type in {'VISU::TMESH'}";
2456 QString aShrinkType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' "
2457 "'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE'}";
2458 QString aLineType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
2459 "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' }";
2461 aRule = "selcount=1";
2462 mgr->setRule( action( VISU_CLIPPING ), aRule + aPrsType, true );
2464 // "Representation" submenu
2465 QString aNotPoints = " and $representation in {'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}";
2466 QString aNotWirefr = " and $representation in {'VISU::POINT' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}";
2467 QString aNotSurfac = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}";
2468 QString aNotInside = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::SURFACEFRAME'}";
2469 QString aNotSurffr = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}";
2471 mgr->setRule( action( VISU_POINTS ) , aRule + aPrsType + aNotPoints, true );
2472 mgr->setRule( action( VISU_WIREFRAME ) , aRule + aPrsType + aNotWirefr, true );
2473 mgr->setRule( action( VISU_SURFACE ) , aRule + aPrsType + aNotSurfac, true );
2474 mgr->setRule( action( VISU_INSIDEFRAME ) , aRule + aInsideType + aNotInside, true );
2475 mgr->setRule( action( VISU_SURFACEFRAME ), aRule + aSurfType + aNotSurffr, true );
2477 mgr->setRule( action( VISU_SHRINK ) , aRule + aShrinkType + " and isShrunk=0", true );
2478 mgr->setRule( action( VISU_UNSHRINK ), aRule + aShrinkType + " and isShrunk=1", true );
2480 mgr->setRule( action( VISU_SHADING ) , aRule + " and isScalarMapAct=1 and isShading=0", true );
2481 mgr->setRule( action( VISU_NOSHADING ), aRule + " and isScalarMapAct=1 and isShading=1", true );
2483 // "Properties" submenu
2484 mgr->setRule( action( VISU_CELL_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'", true );
2485 mgr->setRule( action( VISU_EDGE_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'", true );
2486 mgr->setRule( action( VISU_COLOR ), aRule + " and ((type='VISU::TMESH'"
2487 " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}) "
2488 "or (type='VISU::TDEFORMEDSHAPE' and hasActor=1))", true );
2489 mgr->setRule( action( VISU_OPACITY ), aRule + aShrinkType + " and hasActor=1", true );
2490 mgr->setRule( action( VISU_LINE_WIDTH ), aRule + aLineType + " and hasActor=1", true );
2493 QString aCurveAll = "'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER'";
2495 aRule = "selcount=1 and ($type in {'VISU::TVIEW3D' 'VISU::TMESH' " + aCurveAll + " " + aPrsAll + "})";
2496 mgr->setRule( action( VISU_RENAME ), aRule, true );
2498 // copy presentation command
2499 aRule = "selcount=1 and ($type in {" + aPrsAll + "})";
2500 mgr->setRule( action( VISU_COPY_PRS ), aRule, true );
2503 aRule = "selcount=1 and type='VISU::TCURVE'";
2504 mgr->setRule( action( VISU_CURVE_PROPS ), aRule, true );
2506 // curve container commands
2507 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TCONTAINER'";
2508 mgr->setRule( action( VISU_EDIT_CONTAINER ), aRule, true );
2509 mgr->setRule( action( VISU_CLEAR_CONTAINER ), aRule, true );
2511 mgr->setRule( action( VISU_EDIT_SCALARMAP ),
2512 "selcount=1 and type='VISU::TSCALARMAP'", true );
2513 mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPE ),
2514 "selcount=1 and type='VISU::TDEFORMEDSHAPE'", true );
2515 mgr->setRule( action( VISU_EDIT_SCALARMAPONDEFORMEDSHAPE ),
2516 "selcount=1 and type='VISU::TSCALARMAPONDEFORMEDSHAPE'", true );
2517 mgr->setRule( action( VISU_EDIT_CUTPLANES ),
2518 "selcount=1 and type='VISU::TCUTPLANES'", true );
2519 mgr->setRule( action( VISU_EDIT_CUTLINES ),
2520 "selcount=1 and type='VISU::TCUTLINES'", true );
2521 mgr->setRule( action( VISU_EDIT_ISOSURFACE ),
2522 "selcount=1 and type='VISU::TISOSURFACE'", true );
2523 mgr->setRule( action( VISU_EDIT_VECTORS ),
2524 "selcount=1 and type='VISU::TVECTORS'", true );
2525 mgr->setRule( action( VISU_EDIT_STREAMLINES ),
2526 "selcount=1 and type='VISU::TSTREAMLINES'", true );
2527 mgr->setRule( action( VISU_EDIT_PLOT3D ),
2528 "selcount=1 and type='VISU::TPLOT3D'", true );
2530 aRule = "selcount=1 and type='VISU::TCUTLINES' and nbNamedChildren=0";
2531 mgr->setRule( action( VISU_CREATE_TABLE ), aRule, true );
2533 aRule = "selcount=1 and ($type in {" + aPrsAll + "})";
2534 mgr->setRule( action( VISU_SWEEP ), aRule, true );
2536 // "Selection info" popup item
2537 aRule = "client='VTKViewer' and selcount=1" + aInsideType;
2538 mgr->setRule( action( VISU_SELECTION_INFO ), aRule, true );
2540 aRule = "client='ObjectBrowser' and selcount>0";
2541 aRule += " and $type in {'VISU::TFIELD'}";
2542 aRule += " and nbTimeStamps>1";
2543 aRule += " and activeView in {'VTKViewer' 'VVTK'}";
2544 mgr->setRule( action( VISU_ANIMATION ), aRule, true );
2546 aRule = "client='ObjectBrowser' and $type in {'VISU::TENTITY' 'VISU::TFAMILY' 'VISU::TGROUP'}";
2547 mgr->setRule( action( VISU_CREATE_PRS ), aRule + " and selcount=1", true );
2548 mgr->setRule( action( VISU_CREATE_MANY_PRS ), aRule + " and selcount>1", true );
2550 //aRule = "client='ObjectBrowser' and type='MEDFIELD'";
2551 //mgr->setRule( action( VISU_IMPORT_MED ), aRule, true );
2554 //***************************************************************************
2555 void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, QString& theTitle )
2557 SalomeApp_Module::contextMenuPopup(theClient, theMenu, theTitle);
2559 OB_Browser* ob = getApp()->objectBrowser();
2560 bool isOBClient = (ob && theClient == ob->popupClientType());
2562 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2563 SALOME_ListIO aListIO;
2564 aSelectionMgr->selectedObjects(aListIO);
2566 if (aListIO.Extent() < 1) return;
2568 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2570 // Check if "Merge Scalar Range" can be applied
2572 SALOME_ListIteratorOfListIO It (aListIO);
2573 for (; It.More(); It.Next()) {
2574 Handle(SALOME_InteractiveObject)& anIO = It.Value();
2576 if (!anIO.IsNull() && anIO->hasEntry()) {
2577 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
2580 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSObject);
2581 if (CORBA::is_nil(aCORBAObject)) {
2582 _PTR(GenericAttribute) anAttr;
2583 if (aSObject->FindAttribute(anAttr, "AttributeComment")) {
2584 _PTR(AttributeComment) aComment (anAttr);
2585 string aComm = aComment->Value();
2586 QString strIn (aComm.c_str());
2587 VISU::Storable::TRestoringMap pMap;
2588 VISU::Storable::StrToMap(strIn, pMap);
2590 VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(pMap,"myType",&isExist).toInt();
2591 if (isExist && aType == VISU::TTIMESTAMP) {
2592 _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(aSObject);
2594 for (; anIter->More(); anIter->Next()) {
2595 aPrs = anIter->Value();
2596 if (!aPrs) continue;
2597 std::vector<VISU::Prs3d_i*> aSubList = GetPrs3dList(this, aPrs);
2598 nbPrs += aSubList.size();
2607 theMenu->insertSeparator();
2608 action( VISU_MERGE_SCALAR_BARS )->addTo(theMenu);
2609 action( VISU_FREE_SCALAR_BARS )->addTo(theMenu);
2612 theMenu->insertSeparator();
2614 // Check if some (nb > 0) removable objects selected
2615 if (isOBClient && IsRemovableSelected(this)) {
2616 action( VISU_DELETE_OBJS )->addTo(theMenu);
2619 // Check if some curves selected (for bug PAL10611)
2620 bool isCurves = false;
2621 SALOME_ListIteratorOfListIO It1 (aListIO);
2622 for (; It1.More() && !isCurves; It1.Next()) {
2623 Handle(SALOME_InteractiveObject)& anIO = It1.Value();
2625 if (!anIO.IsNull() && anIO->hasEntry()) {
2626 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
2629 _PTR(GenericAttribute) anAttr;
2630 if (aSObject->FindAttribute(anAttr, "AttributeComment")) {
2631 _PTR(AttributeComment) aComment (anAttr);
2632 string aComm = aComment->Value();
2633 QString strIn (aComm.c_str());
2634 VISU::Storable::TRestoringMap pMap;
2635 VISU::Storable::StrToMap(strIn, pMap);
2637 VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(pMap,"myType",&isExist).toInt();
2638 if (isExist && aType == VISU::TCURVE) {
2645 action( myDisplay )->removeFrom(theMenu);
2646 action( myErase )->removeFrom(theMenu);
2647 action( myDisplayOnly )->removeFrom(theMenu);
2648 action( myEraseAll )->removeFrom(theMenu);
2651 // Check single selection
2652 if (aListIO.Extent() != 1) return;
2654 Handle(SALOME_InteractiveObject) anIO;
2655 VISU::Storable::TRestoringMap aMap;
2656 CORBA::Object_var anObject = GetSelectedObj( this, &anIO, &aMap);
2658 _PTR(SObject) SO = aCStudy->FindObjectID(anIO->getEntry());
2662 VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
2664 if (aType == VISU::TANIMATION) {
2665 action( VISU_SHOW_ANIMATION )->addTo(theMenu);
2667 } else if (isOBClient) {
2668 if (IsSObjectTable(SO)) {
2669 action( VISU_SHOW_TABLE )->addTo(theMenu);
2670 action( VISU_CREATE_CURVES )->addTo(theMenu);
2671 action( VISU_EXPORT_TABLE )->addTo(theMenu);
2672 theMenu->insertSeparator();
2674 if (!CORBA::is_nil(anObject)) {
2675 SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
2676 if (!CORBA::is_nil(aMED.in())) {
2677 action( VISU_IMPORT_MED_STRUCTURE )->addTo(theMenu);
2680 SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject); // "Import Structure"
2681 if (!CORBA::is_nil(aField)) {
2682 action( VISU_IMPORT_MED_TIMESTAMP )->addTo(theMenu); // "Import TimeStamp"
2685 _PTR(SObject) aSFather = SO->GetFather();
2687 _PTR(GenericAttribute) anAttr;
2688 aSFather->FindAttribute(anAttr, "AttributeName");
2690 _PTR(AttributeName) aName (anAttr);
2691 std::string aValue = aName->Value();
2692 if (strcmp(aValue.c_str(), "MEDFIELD") == 0) {
2693 action( VISU_IMPORT_MED_FIELD )->addTo(theMenu); // "Import Field"
2703 //***************************************************************************
2706 windows( QMap<int, int>& theMap ) const
2709 theMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::DockLeft );
2710 theMap.insert( SalomeApp_Application::WT_PyConsole, Qt::DockBottom );
2716 viewManagers( QStringList& theList ) const
2719 // append SVTK viewer only if there is neither SVTK nor VVTK is open
2720 QPtrList<SUIT_ViewManager> lst;
2721 getApp()->viewManagers( SVTK_Viewer::Type(), lst );
2722 if ( !lst.count() ) {
2724 getApp()->viewManagers( VVTK_Viewer::Type(), lst );
2726 theList.append( SVTK_Viewer::Type() );
2735 CORBA::String_var anIOR = GetVisuGen(this)->GetID();
2736 return QString(anIOR.in());
2742 activateModule( SUIT_Study* theStudy )
2744 SalomeApp_Module::activateModule( theStudy );
2746 setMenuShown( true );
2747 setToolShown( true );
2754 deactivateModule( SUIT_Study* theStudy )
2756 setMenuShown( false );
2757 setToolShown( false );
2759 SalomeApp_Module::deactivateModule( theStudy );
2765 createSelection() const
2767 return new VisuGUI_Selection( (SalomeApp_Module*)this );
2770 //******************************************************************
2771 void VisuGUI::studyActivated()
2773 GetVisuGen(this)->SetCurrentStudy(GetDSStudy(GetCStudy(GetAppStudy(this))));
2781 return new VisuGUI();
2786 void VisuGUI::createPreferences()
2788 // TAB: "Scalar Bar"
2789 int sbarTab = addPreference( tr( "VISU_SCALAR_BAR" ) );
2791 int rangeGr = addPreference( tr( "VISU_SCALAR_RANGE" ), sbarTab );
2792 setPreferenceProperty( rangeGr, "columns", 1 );
2794 int mode = addPreference( tr( "VISU_SCALAR_MODE" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_bar_mode" );
2796 modes.append( tr( "VISU_MODULUS" ) );
2797 modes.append( tr( "VISU_COMPONENT" ) + tr("1") );
2798 modes.append( tr( "VISU_COMPONENT" ) + tr("2") );
2799 modes.append( tr( "VISU_COMPONENT" ) + tr("3") );
2800 QValueList<QVariant> indices;
2801 indices.append( 0 );
2802 indices.append( 1 );
2803 indices.append( 2 );
2804 indices.append( 3 );
2805 setPreferenceProperty( mode, "strings", modes );
2806 setPreferenceProperty( mode, "indexes", indices );
2808 addPreference( tr( "VISU_LOGARITHMIC_SCALING" ), rangeGr, LightApp_Preferences::Bool, "VISU", "scalar_bar_logarithmic" );
2810 int rangetype = addPreference( tr( "VISU_RANGE_TO_USE" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_range_type" );
2812 types.append( tr( "VISU_FIELD_RANGE" ) );
2813 types.append( tr( "VISU_IMPOSED_RANGE" ) );
2815 indices.append( 0 );
2816 indices.append( 1 );
2817 setPreferenceProperty( rangetype, "strings", types );
2818 setPreferenceProperty( rangetype, "indexes", indices );
2820 int imposedGr = addPreference( tr( "VISU_MINMAX_IMPOSED_RANGE" ), sbarTab );
2822 int min = addPreference( tr( "VISU_MIN" ), imposedGr, LightApp_Preferences::DblSpin, "VISU", "scalar_range_min" );
2823 int max = addPreference( tr( "VISU_MAX" ), imposedGr, LightApp_Preferences::DblSpin, "VISU", "scalar_range_max" );
2824 setPreferenceProperty( min, "step", 0.1 );
2825 setPreferenceProperty( max, "step", 0.1 );
2828 int fontGr = addPreference( tr( "VISU_FONT" ), sbarTab );
2829 int tfont = addPreference( tr( "VISU_TITLE" ), fontGr,
2830 LightApp_Preferences::Font, "VISU", "scalar_bar_title_font" );
2831 addPreference( tr( "VISU_TITLE" ), fontGr,
2832 LightApp_Preferences::Color, "VISU", "scalar_bar_title_color" );
2833 int lfont = addPreference( tr( "VISU_LABELS" ), fontGr,
2834 LightApp_Preferences::Font, "VISU", "scalar_bar_label_font" );
2835 addPreference( tr( "VISU_LABELS" ), fontGr,
2836 LightApp_Preferences::Color, "VISU", "scalar_bar_label_color" );
2839 fam.append( tr( "VISU_FONT_ARIAL" ) );
2840 fam.append( tr( "VISU_FONT_COURIER" ) );
2841 fam.append( tr( "VISU_FONT_TIMES" ) );
2842 int wflag = ( QtxListResourceEdit::FontItem::All &
2843 ( ~( QtxListResourceEdit::FontItem::Size |
2844 QtxListResourceEdit::FontItem::UserSize ) ) );
2846 setPreferenceProperty( tfont, "families", fam );
2847 setPreferenceProperty( tfont, "system", false );
2848 setPreferenceProperty( tfont, "widget_flags", wflag );
2849 setPreferenceProperty( lfont, "families", fam );
2850 setPreferenceProperty( lfont, "system", false );
2851 setPreferenceProperty( lfont, "widget_flags", wflag );
2853 // group: "Colors & Labels"
2854 int colorsLabelsGr = addPreference( tr( "VISU_COLORS_AND_LABELS" ), sbarTab );
2856 int numcol = addPreference( tr( "VISU_NB_COLORS" ), colorsLabelsGr,
2857 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_num_colors" );
2858 setPreferenceProperty( numcol, "min", 2 );
2859 setPreferenceProperty( numcol, "max", 256 );
2861 int numlab = addPreference( tr( "VISU_NB_LABELS" ), colorsLabelsGr,
2862 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_num_labels" );
2863 setPreferenceProperty( numlab, "min", 2 );
2864 setPreferenceProperty( numlab, "max", 65 );
2866 // group: "Orientation"
2867 int orientGr = addPreference( tr( "VISU_ORIENTATION" ), sbarTab );
2868 int orient = addPreference( tr( "VISU_ORIENTATION" ), orientGr,
2869 LightApp_Preferences::Selector, "VISU", "scalar_bar_orientation" );
2870 QStringList orients;
2871 orients.append( tr( "VISU_VERTICAL" ) );
2872 orients.append( tr( "VISU_HORIZONTAL" ) );
2874 indices.append( 0 );
2875 indices.append( 1 );
2876 setPreferenceProperty( orient, "strings", orients );
2877 setPreferenceProperty( orient, "indexes", indices );
2879 // group: "Origin & Size Vertical"
2880 int posVSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_VERTICAL" ), sbarTab );
2881 int xv = addPreference( tr( "VISU_X" ), posVSizeGr,
2882 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_x" );
2883 int yv = addPreference( tr( "VISU_Y" ), posVSizeGr,
2884 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_y" );
2885 int wv = addPreference( tr( "VISU_WIDTH" ), posVSizeGr,
2886 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_width" );
2887 int hv = addPreference( tr( "VISU_HEIGHT" ), posVSizeGr,
2888 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_height" );
2889 setPreferenceProperty( xv, "step", 0.1 );
2890 setPreferenceProperty( yv, "step", 0.1 );
2891 setPreferenceProperty( wv, "step", 0.1 );
2892 setPreferenceProperty( hv, "step", 0.1 );
2893 setPreferenceProperty( xv, "min", 0.0 );
2894 setPreferenceProperty( yv, "min", 0.0 );
2895 setPreferenceProperty( wv, "min", 0.0 );
2896 setPreferenceProperty( hv, "min", 0.0 );
2897 setPreferenceProperty( xv, "max", 1.0 );
2898 setPreferenceProperty( yv, "max", 1.0 );
2899 setPreferenceProperty( wv, "max", 1.0 );
2900 setPreferenceProperty( hv, "max", 1.0 );
2902 // group: "Origin & Size Horizontal"
2903 int posHSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_HORIZONTAL" ), sbarTab );
2904 int xh = addPreference( tr( "VISU_X" ), posHSizeGr,
2905 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_x" );
2906 int yh = addPreference( tr( "VISU_Y" ), posHSizeGr,
2907 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_y" );
2908 int wh = addPreference( tr( "VISU_WIDTH" ), posHSizeGr,
2909 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_width" );
2910 int hh = addPreference( tr( "VISU_HEIGHT" ), posHSizeGr,
2911 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_height" );
2912 setPreferenceProperty( xh, "step", 0.1 );
2913 setPreferenceProperty( yh, "step", 0.1 );
2914 setPreferenceProperty( wh, "step", 0.1 );
2915 setPreferenceProperty( hh, "step", 0.1 );
2916 setPreferenceProperty( xh, "min", 0.0 );
2917 setPreferenceProperty( yh, "min", 0.0 );
2918 setPreferenceProperty( wh, "min", 0.0 );
2919 setPreferenceProperty( hh, "min", 0.0 );
2920 setPreferenceProperty( xh, "max", 1.0 );
2921 setPreferenceProperty( yh, "max", 1.0 );
2922 setPreferenceProperty( wh, "max", 1.0 );
2923 setPreferenceProperty( hh, "max", 1.0 );
2925 // group: "Scalar bars default position"
2926 int scalarBarGr = addPreference( tr( "Scalar bars default position" ), sbarTab );
2927 addPreference( tr( "Arrange Scalar Bars" ), scalarBarGr, LightApp_Preferences::Bool, "VISU", "scalar_bars_default_position" );
2929 int srangeTab = addPreference( tr( "Sweep, MED import" ) );
2931 // group: "Sweeping preferences"
2932 int sweepGr = addPreference( tr( "VISU_SWEEPING_PREF" ), srangeTab );
2933 setPreferenceProperty( sweepGr, "columns", 1 );
2935 int timestep = addPreference( tr( "VISU_TIME_STEP" ), sweepGr,
2936 LightApp_Preferences::DblSpin, "VISU", "sweeping_time_step" );
2937 int nbcycles = addPreference( tr( "VISU_NB_CYCLES" ), sweepGr,
2938 LightApp_Preferences::IntSpin, "VISU", "sweeping_number_cycles" );
2939 int nbsteps = addPreference( tr( "VISU_NB_STEPS" ), sweepGr,
2940 LightApp_Preferences::IntSpin, "VISU", "sweeping_number_steps" );
2941 setPreferenceProperty( timestep, "min", 0.1 );
2942 setPreferenceProperty( timestep, "step", 0.1 );
2943 setPreferenceProperty( timestep, "max", 1000 );
2944 setPreferenceProperty( nbcycles, "max", 100 );
2945 setPreferenceProperty( nbsteps, "max", 200 );
2947 // group: "MED files import"
2948 int importGr = addPreference( tr( "MED files import" ), srangeTab );
2949 setPreferenceProperty( importGr, "columns", 1 );
2950 addPreference( tr( "Use build progress" ), importGr, LightApp_Preferences::Bool, "VISU", "use_build_progress" );
2951 addPreference( tr( "Full MED loading" ), importGr, LightApp_Preferences::Bool, "VISU", "full_med_loading" );
2952 addPreference( tr( "Build at once" ), importGr, LightApp_Preferences::Bool, "VISU", "build_at_once" );
2953 addPreference( tr( "Build fields" ), importGr, LightApp_Preferences::Bool, "VISU", "build_fields" );
2954 addPreference( tr( "Build min/max" ), importGr, LightApp_Preferences::Bool, "VISU", "build_min_max" );
2955 addPreference( tr( "Build groups" ), importGr, LightApp_Preferences::Bool, "VISU", "build_groups" );
2956 addPreference( tr( "Close dialog at finish" ), importGr, LightApp_Preferences::Bool, "VISU", "close_at_finish" );
2958 // group: "Representation properties"
2959 int representGr = addPreference( tr( "VISU_PREF_REPRESENT_PROPS" ), srangeTab );
2960 addPreference( tr( "VISU_PREF_SHADING" ), representGr,
2961 LightApp_Preferences::Bool, "VISU", "represent_shading" );
2964 void VisuGUI::preferencesChanged( const QString& a, const QString& b)
2966 if (a != QString("VISU")) return;
2967 if (b == QString("scalar_bar_orientation")) return;
2968 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
2969 float sbX1,sbY1,sbW,sbH;
2970 float aTol = 1.00000009999999;
2971 std::string aWarning;
2972 if(b == QString("scalar_bar_vertical_x") || b == QString("scalar_bar_vertical_width")){
2973 sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_x", sbX1);
2974 sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_width", sbW);
2975 if(sbX1+sbW > aTol){
2976 aWarning = "Origin and Size Vertical: X+Width > 1\n";
2979 aResourceMgr->setValue("VISU", "scalar_bar_vertical_x", sbX1);
2980 aResourceMgr->setValue("VISU", "scalar_bar_vertical_width", sbW);
2983 else if(b == QString("scalar_bar_vertical_y") || b == QString("scalar_bar_vertical_height")){
2984 sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_y", sbY1);
2985 sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_height",sbH);
2986 if(sbY1+sbH > aTol){
2987 aWarning = "Origin and Size Vertical: Y+Height > 1\n";
2990 aResourceMgr->setValue("VISU", "scalar_bar_vertical_y", sbY1);
2991 aResourceMgr->setValue("VISU", "scalar_bar_vertical_height",sbH);
2994 else if(b == QString("scalar_bar_horizontal_x") || b == QString("scalar_bar_horizontal_width")){
2995 sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_x", sbX1);
2996 sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_width", sbW);
2997 if(sbX1+sbW > aTol){
2998 aWarning = "Origin and Size Horizontal: X+Width > 1\n";
3001 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_x", sbX1);
3002 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_width", sbW);
3005 else if(b == QString("scalar_bar_horizontal_y") || b == QString("scalar_bar_horizontal_height")){
3006 sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_y", sbY1);
3007 sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_height",sbH);
3008 if(sbY1+sbH > aTol){
3009 aWarning = "Origin and Size Horizontal: Y+Height > 1\n";
3012 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_y", sbY1);
3013 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_height",sbH);
3016 if (aWarning.size() != 0){
3017 aWarning += "The default values are applied instead.";
3018 SUIT_MessageBox::warn1(GetDesktop(this),
3019 tr("ERR_SCALARBAR_PARAMS"),
3020 tr(aWarning.c_str()),
3027 ::getViewManager(const QString& theType,
3028 const bool theIsCreate)
3030 return getApp()->getViewManager(theType,theIsCreate);
3035 ::getScalarBarsMap()
3037 return myScalarBarsMap;
3039 LightApp_Displayer* VisuGUI::displayer()
3042 myDisplayer = new VisuGUI_Displayer( getApp() );