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()));
2217 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT_3D"));
2218 createAction( VISU_PLOT3D_FROM_CUTPLANE, tr("MEN_PLOT3D_FROM_CUTPLANE"), QIconSet(aPixmap),
2219 tr("MEN_PLOT3D_FROM_CUTPLANE"), "", 0, aParent, false,
2220 this, SLOT(OnPlot3dFromCutPlane()));
2227 // Add actions to menus
2229 aMenuId = createMenu( tr( "MEN_DESK_FILE" ), -1 );
2230 createMenu( separator(), aMenuId, -1, 10 );
2232 int anImportId = createMenu( tr( "MEN_IMPORT" ), aMenuId, -1, 10 );
2233 createMenu( VISU_IMPORT_FROM_FILE, anImportId ); // import from file
2234 createMenu( VISU_IMPORT_TABLE, anImportId ); // import table
2236 aMenuId = createMenu( tr( "MEN_VISUALIZATION" ), -1, -1, 30 );
2237 createMenu( VISU_SCALAR_MAP, aMenuId, 10 ); // scalar map
2238 createMenu( VISU_DEFORMED_SHAPE, aMenuId, 10 ); // deformed shape
2239 createMenu( VISU_VECTORS, aMenuId, 10 ); // vectors
2240 createMenu( VISU_ISO_SURFACES, aMenuId, 10 ); // iso surfaces
2241 createMenu( VISU_CUT_PLANES, aMenuId, 10 ); // cut planes
2242 createMenu( VISU_CUT_LINES, aMenuId, 10 ); // cut lines
2243 createMenu( VISU_STREAM_LINES, aMenuId, 10 ); // stream lines
2244 createMenu( VISU_PLOT_3D, aMenuId, 10 ); // Plot3d
2245 createMenu( VISU_SCALAR_MAP_ON_DEFORMED_SHAPE, aMenuId, 10 ); // scalar map on deformed shape
2247 aMenuId = createMenu( tr( "MEN_SELECTION" ), -1, -1, 30 );
2248 createMenu( VISU_SELECTION_INFO, aMenuId, 10 ); // selection info
2250 aMenuId = createMenu( tr( "MEN_REPRESENTATION" ), -1, -1, 30 );
2252 createMenu( tr( "MEN_DISPLAY_SELECTION" ), aMenuId, 10 ); // display selection
2253 createMenu( VISU_POINTS, parentId, 10 ); // points
2254 createMenu( VISU_WIREFRAME, parentId, 10 ); // wireframe
2255 createMenu( VISU_SURFACE, parentId, 10 ); // surface
2256 createMenu( VISU_ERASE_ALL, aMenuId, 10 ); // erase all
2257 createMenu( VISU_GLOBAL_SELECTION, aMenuId, 10 ); // global selection
2258 createMenu( VISU_PARTIAL_SELECTION, aMenuId, 10 ); // partial selection
2265 int aToolId = createTool(tr("TOOL_VISUALISATION"));
2266 createTool( VISU_SCALAR_MAP, aToolId );
2267 createTool( VISU_DEFORMED_SHAPE, aToolId );
2268 createTool( VISU_VECTORS, aToolId );
2269 createTool( VISU_ISO_SURFACES, aToolId );
2270 createTool( VISU_CUT_PLANES, aToolId );
2271 createTool( VISU_CUT_LINES, aToolId );
2272 createTool( VISU_STREAM_LINES, aToolId );
2273 createTool( VISU_PLOT_3D, aToolId );
2274 createTool( VISU_SCALAR_MAP_ON_DEFORMED_SHAPE, aToolId );
2276 aToolId = createTool(tr("TOOL_REPRESENTATION"));
2277 createTool( VISU_POINTS, aToolId );
2278 createTool( VISU_WIREFRAME, aToolId );
2279 createTool( VISU_SURFACE, aToolId );
2280 createTool( VISU_ERASE_ALL, aToolId );
2281 createTool( VISU_GLOBAL_SELECTION, aToolId );
2282 createTool( VISU_PARTIAL_SELECTION, aToolId );
2289 // Prepare popup menus
2290 QtxPopupMgr* mgr = popupMgr();
2292 // VISU root commands
2293 mgr->insert( action( VISU_IMPORT_FROM_FILE ), -1, -1, -1 ); // import MED file
2294 mgr->insert( action( VISU_IMPORT_TABLE ), -1, -1, -1 ); // import tables from file
2295 mgr->insert( action( VISU_PLOT2D ), -1, -1, -1 ); // create Plot2d View
2297 //mgr->insert( action( VISU_IMPORT_MED ), -1, -1, -1 ); // import MED structure from MED module
2300 mgr->insert( action( VISU_SCALAR_MAP ), -1, -1, -1 ); // scalar bar
2301 mgr->insert( action( VISU_ISO_SURFACES ), -1, -1, -1 ); // iso surface
2302 mgr->insert( action( VISU_CUT_PLANES ), -1, -1, -1 ); // cut planes
2303 mgr->insert( action( VISU_CUT_LINES ), -1, -1, -1 ); // cut lines
2304 mgr->insert( action( VISU_DEFORMED_SHAPE ), -1, -1, -1 ); // deformed shape
2305 mgr->insert( action( VISU_VECTORS ), -1, -1, -1 ); // vectors
2306 mgr->insert( action( VISU_STREAM_LINES ), -1, -1, -1 ); // stream lines
2307 mgr->insert( action( VISU_PLOT_3D ), -1, -1, -1 ); // Plot3d
2308 mgr->insert( action( VISU_SCALAR_MAP_ON_DEFORMED_SHAPE ), -1, -1, -1 ); // scalar map on deformed shape
2310 mgr->insert( action( VISU_CREATE_PRS ), -1, -1, -1 ); // create presentation
2311 mgr->insert( action( VISU_CREATE_MANY_PRS ), -1, -1, -1 ); // create presentations
2313 mgr->insert( action( VISU_CREATE_TABLE ), -1, -1, -1 ); // create table
2316 mgr->insert( action( VISU_EDIT_SCALARMAP ), -1, -1, -1 );
2317 mgr->insert( action( VISU_EDIT_DEFORMEDSHAPE ), -1, -1, -1 );
2318 mgr->insert( action( VISU_EDIT_CUTPLANES ), -1, -1, -1 );
2319 mgr->insert( action( VISU_EDIT_CUTLINES ), -1, -1, -1 );
2320 mgr->insert( action( VISU_EDIT_ISOSURFACE ), -1, -1, -1 );
2321 mgr->insert( action( VISU_EDIT_VECTORS ), -1, -1, -1 );
2322 mgr->insert( action( VISU_EDIT_STREAMLINES ), -1, -1, -1 );
2323 mgr->insert( action( VISU_EDIT_PLOT3D ), -1, -1, -1 );
2324 mgr->insert( action( VISU_EDIT_SCALARMAPONDEFORMEDSHAPE ), -1, -1, -1 );
2325 mgr->insert( action( VISU_EDIT_CONTAINER ), -1, -1, -1 );
2328 mgr->insert( action( VISU_RENAME ), -1, -1, -1 );
2331 mgr->insert( action( VISU_COPY_PRS ), -1, -1, -1 );
2334 mgr->insert( action( VISU_CLEAR_CONTAINER ), -1, -1, -1 );
2337 //mgr->insert( action( VISU_SHOW_TABLE ), -1, -1, -1 ); // show table
2338 //mgr->insert( action( VISU_CREATE_CURVES ), -1, -1, -1 ); // create curves
2339 //mgr->insert( action( VISU_EXPORT_TABLE ), -1, -1, -1 ); // export table
2341 mgr->insert( separator(), -1, -1, -1 );
2343 mgr->insert( action( VISU_ERASE ), -1, -1, -1 ); // erase
2344 mgr->insert( action( VISU_DISPLAY ), -1, -1, -1 ); // display
2345 mgr->insert( action( VISU_DISPLAY_ONLY ), -1, -1, -1 ); // display only
2347 // "Representation" submenu
2348 int parentId = mgr->insert( tr( "MEN_REPRESENTATION" ), -1, -1 );
2349 mgr->insert( action( VISU_POINTS ) , parentId, -1, -1 ); // points
2350 mgr->insert( action( VISU_WIREFRAME ) , parentId, -1, -1 ); // wireframe
2351 mgr->insert( action( VISU_SURFACE ) , parentId, -1, -1 ); // surface
2352 mgr->insert( action( VISU_INSIDEFRAME ) , parentId, -1, -1 ); // insideframe
2353 mgr->insert( action( VISU_SURFACEFRAME ), parentId, -1, -1 ); // surfaceframe
2354 mgr->insert( action( VISU_SHRINK ) , parentId, -1, -1 ); // shrink
2355 mgr->insert( action( VISU_UNSHRINK ) , parentId, -1, -1 ); // unshrink
2356 mgr->insert( separator(), parentId, -1, -1 );
2357 mgr->insert( action( VISU_SHADING ) , parentId, -1, -1 ); // shading
2358 mgr->insert( action( VISU_NOSHADING ) , parentId, -1, -1 ); // noshading
2360 // "Properties" submenu
2361 parentId = mgr->insert( tr( "MEN_PROPERTIES" ), -1, -1 );
2362 mgr->insert( action( VISU_CELL_COLOR ), parentId, -1, -1 ); // cell color
2363 mgr->insert( action( VISU_EDGE_COLOR ), parentId, -1, -1 ); // edge color
2364 mgr->insert( action( VISU_COLOR ) , parentId, -1, -1 ); // color
2365 mgr->insert( action( VISU_OPACITY ) , parentId, -1, -1 ); // opacity
2366 mgr->insert( action( VISU_LINE_WIDTH ), parentId, -1, -1 ); // line width
2368 mgr->insert( separator(), -1, -1, -1 );
2370 // Other presentations management
2371 mgr->insert( action( VISU_TRANSLATE_PRS ), -1, -1, -1 );
2372 mgr->insert( action( VISU_CLIPPING ), -1, -1, -1 );
2374 mgr->insert( action( VISU_MERGE_SCALAR_BARS ), -1, -1, -1 );
2375 mgr->insert( action( VISU_FREE_SCALAR_BARS ), -1, -1, -1 );
2377 mgr->insert( action( VISU_SWEEP ), -1, -1, -1 );
2378 mgr->insert( action( VISU_ANIMATION ), -1, -1, -1 );
2380 mgr->insert( separator(), -1, -1, -1 );
2382 // view parameters commands
2383 mgr->insert( action( VISU_SAVE_VIEW_PARAMS ), -1, -1, -1 ); // save view params
2384 mgr->insert( action( VISU_SAVE_VIEW_PARAMS_1 ), -1, -1, -1 ); // save view params
2385 mgr->insert( action( VISU_RESTORE_VIEW_PARAMS ), -1, -1, -1 ); // restore view params
2386 //mgr->insert( action( VISU_DELETE_VIEW_PARAMS ), -1, -1, -1 ); // delete view params
2388 mgr->insert( action( VISU_ARRANGE_ACTORS ), -1, -1, -1 ); // arrange actors
2390 mgr->insert( action( VISU_CURVE_PROPS ), -1, -1, -1 ); // curve properties
2392 mgr->insert( action( VISU_SELECTION_INFO ), -1, -1, -1 ); // Selection info
2396 QString aPrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
2397 "'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE'");
2399 // VISU root commands
2400 QString aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TVISUGEN'";
2401 mgr->setRule( action( VISU_IMPORT_FROM_FILE ), aRule, true );
2402 mgr->setRule( action( VISU_IMPORT_TABLE ), aRule, true );
2403 mgr->setRule( action( VISU_PLOT2D ), aRule, true );
2405 // timestamp commands
2406 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TTIMESTAMP'";
2407 mgr->setRule( action( VISU_SCALAR_MAP ), aRule, true );
2408 mgr->setRule( action( VISU_ISO_SURFACES ), aRule, true );
2409 mgr->setRule( action( VISU_CUT_PLANES ), aRule, true );
2410 mgr->setRule( action( VISU_CUT_LINES ), aRule, true );
2411 mgr->setRule( action( VISU_PLOT_3D ), aRule, true );
2412 aRule += " and nbComponents>1";
2413 mgr->setRule( action( VISU_DEFORMED_SHAPE ), aRule, true );
2414 mgr->setRule( action( VISU_VECTORS ), aRule, true );
2415 mgr->setRule( action( VISU_STREAM_LINES ), aRule, true );
2416 mgr->setRule( action( VISU_SCALAR_MAP_ON_DEFORMED_SHAPE ), aRule, true );
2418 // display/erase commands
2419 QString andInvisible = " and (((not isVisible) and isActiveView) or (not isActiveView))";
2420 QString aTableOrCont = "(type='VISU::TTABLE' and nbChildren>0) or type='VISU::TCONTAINER'";
2421 QString orCurveVisible = "or (type='VISU::TCURVE' and isVisible)";
2422 QString orCurveInvisible = "or (type='VISU::TCURVE'" + andInvisible + ")";
2423 QString aPrsVisible = "(($type in {'VISU::TMESH' " + aPrsAll + "}) and isVisible)";
2424 QString aPrsInvisible = "(($type in {'VISU::TMESH' " + aPrsAll + "})" + andInvisible + ")";
2425 QString aComponent = "( selcount=1 and canBeDisplayed and isComponent )";
2427 QString anEraseRule = "( selcount>0 and ({true} in $canBeDisplayed) and (" + aPrsVisible +
2428 " or (client='ObjectBrowser' and (" + aTableOrCont + orCurveVisible + "))) ) or " + aComponent;
2430 QString aDisplayRule = "( selcount>0 and ({true} in $canBeDisplayed) and (" + aPrsInvisible +
2431 " or (client='ObjectBrowser' and (" + aTableOrCont + orCurveInvisible + "))) ) or" + aComponent;
2433 QString aDOnlyRule = "( selcount>0 and ({true} in $canBeDisplayed) and (($type in {'VISU::TMESH' " + aPrsAll + "})"
2434 " or (client='ObjectBrowser' and ((type='VISU::TTABLE' and nbChildren>0) or"
2435 " ($type in {'VISU::TCURVE' 'VISU::TCONTAINER'})))) ) or" + aComponent;
2437 mgr->setRule( action( VISU_ERASE ), anEraseRule, true );
2438 mgr->setRule( action( VISU_DISPLAY ), aDisplayRule, true );
2439 mgr->setRule( action( VISU_DISPLAY_ONLY ), aDOnlyRule, true );
2441 aRule = "selcount>0 and $type in {'VISU::TMESH' " + aPrsAll + "}";
2442 mgr->setRule( action( VISU_TRANSLATE_PRS ), aRule, true );
2444 aRule = "selcount>1 and $type in {'VISU::TMESH' " + aPrsAll + "}";
2445 mgr->setRule( action( VISU_MERGE_SCALAR_BARS ), aRule, true );
2446 mgr->setRule( action( VISU_FREE_SCALAR_BARS ), aRule, true );
2449 aRule = "selcount=1 and type='VISU::TVIEW3D' and activeView='VTKViewer'";
2450 mgr->setRule( action( VISU_SAVE_VIEW_PARAMS_1 ), aRule, true );
2451 mgr->setRule( action( VISU_SAVE_VIEW_PARAMS ), "client='VTKViewer' and selcount=0 and activeView='VTKViewer'", true );
2452 mgr->setRule( action( VISU_RESTORE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D' and activeView='VTKViewer'", true );
2453 //mgr->setRule( action( VISU_DELETE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D'", true );
2455 mgr->setRule( action( VISU_ARRANGE_ACTORS ), "client='VTKViewer' and selcount=0", true );
2457 // 3D presentations commands
2458 QString aPrsType = " and $type in {'VISU::TMESH' " + aPrsAll + "}";
2459 QString aInsideType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE'}";
2460 QString aSurfType = " and $type in {'VISU::TMESH'}";
2461 QString aShrinkType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' "
2462 "'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE'}";
2463 QString aLineType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
2464 "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' }";
2466 aRule = "selcount=1";
2467 mgr->setRule( action( VISU_CLIPPING ), aRule + aPrsType, true );
2469 // "Representation" submenu
2470 QString aNotPoints = " and $representation in {'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}";
2471 QString aNotWirefr = " and $representation in {'VISU::POINT' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}";
2472 QString aNotSurfac = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}";
2473 QString aNotInside = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::SURFACEFRAME'}";
2474 QString aNotSurffr = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}";
2476 mgr->setRule( action( VISU_POINTS ) , aRule + aPrsType + aNotPoints, true );
2477 mgr->setRule( action( VISU_WIREFRAME ) , aRule + aPrsType + aNotWirefr, true );
2478 mgr->setRule( action( VISU_SURFACE ) , aRule + aPrsType + aNotSurfac, true );
2479 mgr->setRule( action( VISU_INSIDEFRAME ) , aRule + aInsideType + aNotInside, true );
2480 mgr->setRule( action( VISU_SURFACEFRAME ), aRule + aSurfType + aNotSurffr, true );
2482 mgr->setRule( action( VISU_SHRINK ) , aRule + aShrinkType + " and isShrunk=0", true );
2483 mgr->setRule( action( VISU_UNSHRINK ), aRule + aShrinkType + " and isShrunk=1", true );
2485 mgr->setRule( action( VISU_SHADING ) , aRule + " and isScalarMapAct=1 and isShading=0", true );
2486 mgr->setRule( action( VISU_NOSHADING ), aRule + " and isScalarMapAct=1 and isShading=1", true );
2488 // "Properties" submenu
2489 mgr->setRule( action( VISU_CELL_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'", true );
2490 mgr->setRule( action( VISU_EDGE_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'", true );
2491 mgr->setRule( action( VISU_COLOR ), aRule + " and ((type='VISU::TMESH'"
2492 " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}) "
2493 "or (type='VISU::TDEFORMEDSHAPE' and hasActor=1))", true );
2494 mgr->setRule( action( VISU_OPACITY ), aRule + aShrinkType + " and hasActor=1", true );
2495 mgr->setRule( action( VISU_LINE_WIDTH ), aRule + aLineType + " and hasActor=1", true );
2498 QString aCurveAll = "'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER'";
2500 aRule = "selcount=1 and ($type in {'VISU::TVIEW3D' 'VISU::TMESH' " + aCurveAll + " " + aPrsAll + "})";
2501 mgr->setRule( action( VISU_RENAME ), aRule, true );
2503 // copy presentation command
2504 aRule = "selcount=1 and ($type in {" + aPrsAll + "})";
2505 mgr->setRule( action( VISU_COPY_PRS ), aRule, true );
2508 aRule = "selcount=1 and type='VISU::TCURVE'";
2509 mgr->setRule( action( VISU_CURVE_PROPS ), aRule, true );
2511 // curve container commands
2512 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TCONTAINER'";
2513 mgr->setRule( action( VISU_EDIT_CONTAINER ), aRule, true );
2514 mgr->setRule( action( VISU_CLEAR_CONTAINER ), aRule, true );
2516 mgr->setRule( action( VISU_EDIT_SCALARMAP ),
2517 "selcount=1 and type='VISU::TSCALARMAP'", true );
2518 mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPE ),
2519 "selcount=1 and type='VISU::TDEFORMEDSHAPE'", true );
2520 mgr->setRule( action( VISU_EDIT_SCALARMAPONDEFORMEDSHAPE ),
2521 "selcount=1 and type='VISU::TSCALARMAPONDEFORMEDSHAPE'", true );
2522 mgr->setRule( action( VISU_EDIT_CUTPLANES ),
2523 "selcount=1 and type='VISU::TCUTPLANES'", true );
2524 mgr->setRule( action( VISU_EDIT_CUTLINES ),
2525 "selcount=1 and type='VISU::TCUTLINES'", true );
2526 mgr->setRule( action( VISU_EDIT_ISOSURFACE ),
2527 "selcount=1 and type='VISU::TISOSURFACE'", true );
2528 mgr->setRule( action( VISU_EDIT_VECTORS ),
2529 "selcount=1 and type='VISU::TVECTORS'", true );
2530 mgr->setRule( action( VISU_EDIT_STREAMLINES ),
2531 "selcount=1 and type='VISU::TSTREAMLINES'", true );
2532 mgr->setRule( action( VISU_EDIT_PLOT3D ),
2533 "selcount=1 and type='VISU::TPLOT3D'", true );
2535 aRule = "selcount=1 and type='VISU::TCUTLINES' and nbNamedChildren=0";
2536 mgr->setRule( action( VISU_CREATE_TABLE ), aRule, true );
2538 aRule = "selcount=1 and ($type in {" + aPrsAll + "})";
2539 mgr->setRule( action( VISU_SWEEP ), aRule, true );
2541 // "Selection info" popup item
2542 aRule = "client='VTKViewer' and selcount=1" + aInsideType;
2543 mgr->setRule( action( VISU_SELECTION_INFO ), aRule, true );
2545 aRule = "client='ObjectBrowser' and selcount>0";
2546 aRule += " and $type in {'VISU::TFIELD'}";
2547 aRule += " and nbTimeStamps>1";
2548 aRule += " and activeView in {'VTKViewer' 'VVTK'}";
2549 mgr->setRule( action( VISU_ANIMATION ), aRule, true );
2551 aRule = "client='ObjectBrowser' and $type in {'VISU::TENTITY' 'VISU::TFAMILY' 'VISU::TGROUP'}";
2552 mgr->setRule( action( VISU_CREATE_PRS ), aRule + " and selcount=1", true );
2553 mgr->setRule( action( VISU_CREATE_MANY_PRS ), aRule + " and selcount>1", true );
2555 //aRule = "client='ObjectBrowser' and type='MEDFIELD'";
2556 //mgr->setRule( action( VISU_IMPORT_MED ), aRule, true );
2559 //***************************************************************************
2560 void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, QString& theTitle )
2562 SalomeApp_Module::contextMenuPopup(theClient, theMenu, theTitle);
2564 OB_Browser* ob = getApp()->objectBrowser();
2565 bool isOBClient = (ob && theClient == ob->popupClientType());
2567 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2568 SALOME_ListIO aListIO;
2569 aSelectionMgr->selectedObjects(aListIO);
2571 if (aListIO.Extent() < 1) return;
2573 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2575 // Check if "Merge Scalar Range" can be applied
2577 SALOME_ListIteratorOfListIO It (aListIO);
2578 for (; It.More(); It.Next()) {
2579 Handle(SALOME_InteractiveObject)& anIO = It.Value();
2581 if (!anIO.IsNull() && anIO->hasEntry()) {
2582 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
2585 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSObject);
2586 if (CORBA::is_nil(aCORBAObject)) {
2587 _PTR(GenericAttribute) anAttr;
2588 if (aSObject->FindAttribute(anAttr, "AttributeComment")) {
2589 _PTR(AttributeComment) aComment (anAttr);
2590 string aComm = aComment->Value();
2591 QString strIn (aComm.c_str());
2592 VISU::Storable::TRestoringMap pMap;
2593 VISU::Storable::StrToMap(strIn, pMap);
2595 VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(pMap,"myType",&isExist).toInt();
2596 if (isExist && aType == VISU::TTIMESTAMP) {
2597 _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(aSObject);
2599 for (; anIter->More(); anIter->Next()) {
2600 aPrs = anIter->Value();
2601 if (!aPrs) continue;
2602 std::vector<VISU::Prs3d_i*> aSubList = GetPrs3dList(this, aPrs);
2603 nbPrs += aSubList.size();
2611 theMenu->insertSeparator();
2612 action( VISU_MERGE_SCALAR_BARS )->addTo(theMenu);
2613 action( VISU_FREE_SCALAR_BARS )->addTo(theMenu);
2616 // Check if some curves selected (for bug PAL10611)
2617 bool isCurves = false;
2618 bool isOneCutPlane = false;
2619 SALOME_ListIteratorOfListIO It1 (aListIO);
2620 for (; It1.More() && !isCurves; It1.Next()) {
2621 Handle(SALOME_InteractiveObject)& anIO = It1.Value();
2623 if (!anIO.IsNull() && anIO->hasEntry()) {
2624 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
2627 _PTR(GenericAttribute) anAttr;
2628 if (aSObject->FindAttribute(anAttr, "AttributeComment")) {
2629 _PTR(AttributeComment) aComment (anAttr);
2630 string aComm = aComment->Value();
2631 QString strIn (aComm.c_str());
2632 VISU::Storable::TRestoringMap pMap;
2633 VISU::Storable::StrToMap(strIn, pMap);
2635 VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(pMap,"myType",&isExist).toInt();
2636 if (isExist && aType == VISU::TCURVE) {
2639 CORBA::Object_var anObject = GetSelectedObj(GetAppStudy(this), anIO->getEntry());
2640 if (!CORBA::is_nil(anObject)) {
2641 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
2642 if (aPrsObject->GetType() == VISU::TCUTPLANES) {
2643 VISU::CutPlanes_i* aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
2645 isOneCutPlane = aCutPrs->GetNbPlanes() == 1;
2655 action( VISU_PLOT3D_FROM_CUTPLANE )->addTo(theMenu);
2657 theMenu->insertSeparator();
2659 // Check if some (nb > 0) removable objects selected
2660 if (isOBClient && IsRemovableSelected(this)) {
2661 action( VISU_DELETE_OBJS )->addTo(theMenu);
2664 action( myDisplay )->removeFrom(theMenu);
2665 action( myErase )->removeFrom(theMenu);
2666 action( myDisplayOnly )->removeFrom(theMenu);
2667 action( myEraseAll )->removeFrom(theMenu);
2670 // Check single selection
2671 if (aListIO.Extent() != 1) return;
2673 Handle(SALOME_InteractiveObject) anIO;
2674 VISU::Storable::TRestoringMap aMap;
2675 CORBA::Object_var anObject = GetSelectedObj( this, &anIO, &aMap);
2677 _PTR(SObject) SO = aCStudy->FindObjectID(anIO->getEntry());
2681 VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
2683 if (aType == VISU::TANIMATION) {
2684 action( VISU_SHOW_ANIMATION )->addTo(theMenu);
2686 } else if (isOBClient) {
2687 if (IsSObjectTable(SO)) {
2688 action( VISU_SHOW_TABLE )->addTo(theMenu);
2689 action( VISU_CREATE_CURVES )->addTo(theMenu);
2690 action( VISU_EXPORT_TABLE )->addTo(theMenu);
2691 theMenu->insertSeparator();
2693 if (!CORBA::is_nil(anObject)) {
2694 SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
2695 if (!CORBA::is_nil(aMED.in())) {
2696 action( VISU_IMPORT_MED_STRUCTURE )->addTo(theMenu);
2699 SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject); // "Import Structure"
2700 if (!CORBA::is_nil(aField)) {
2701 action( VISU_IMPORT_MED_TIMESTAMP )->addTo(theMenu); // "Import TimeStamp"
2704 _PTR(SObject) aSFather = SO->GetFather();
2706 _PTR(GenericAttribute) anAttr;
2707 aSFather->FindAttribute(anAttr, "AttributeName");
2709 _PTR(AttributeName) aName (anAttr);
2710 std::string aValue = aName->Value();
2711 if (strcmp(aValue.c_str(), "MEDFIELD") == 0) {
2712 action( VISU_IMPORT_MED_FIELD )->addTo(theMenu); // "Import Field"
2722 //***************************************************************************
2725 windows( QMap<int, int>& theMap ) const
2728 theMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::DockLeft );
2729 theMap.insert( SalomeApp_Application::WT_PyConsole, Qt::DockBottom );
2735 viewManagers( QStringList& theList ) const
2738 // append SVTK viewer only if there is neither SVTK nor VVTK is open
2739 QPtrList<SUIT_ViewManager> lst;
2740 getApp()->viewManagers( SVTK_Viewer::Type(), lst );
2741 if ( !lst.count() ) {
2743 getApp()->viewManagers( VVTK_Viewer::Type(), lst );
2745 theList.append( SVTK_Viewer::Type() );
2754 CORBA::String_var anIOR = GetVisuGen(this)->GetID();
2755 return QString(anIOR.in());
2761 activateModule( SUIT_Study* theStudy )
2763 SalomeApp_Module::activateModule( theStudy );
2765 setMenuShown( true );
2766 setToolShown( true );
2773 deactivateModule( SUIT_Study* theStudy )
2775 setMenuShown( false );
2776 setToolShown( false );
2778 SalomeApp_Module::deactivateModule( theStudy );
2784 createSelection() const
2786 return new VisuGUI_Selection( (SalomeApp_Module*)this );
2789 //******************************************************************
2790 void VisuGUI::studyActivated()
2792 GetVisuGen(this)->SetCurrentStudy(GetDSStudy(GetCStudy(GetAppStudy(this))));
2800 return new VisuGUI();
2805 void VisuGUI::createPreferences()
2807 // TAB: "Scalar Bar"
2808 int sbarTab = addPreference( tr( "VISU_SCALAR_BAR" ) );
2810 int rangeGr = addPreference( tr( "VISU_SCALAR_RANGE" ), sbarTab );
2811 setPreferenceProperty( rangeGr, "columns", 1 );
2813 int mode = addPreference( tr( "VISU_SCALAR_MODE" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_bar_mode" );
2815 modes.append( tr( "VISU_MODULUS" ) );
2816 modes.append( tr( "VISU_COMPONENT" ) + tr("1") );
2817 modes.append( tr( "VISU_COMPONENT" ) + tr("2") );
2818 modes.append( tr( "VISU_COMPONENT" ) + tr("3") );
2819 QValueList<QVariant> indices;
2820 indices.append( 0 );
2821 indices.append( 1 );
2822 indices.append( 2 );
2823 indices.append( 3 );
2824 setPreferenceProperty( mode, "strings", modes );
2825 setPreferenceProperty( mode, "indexes", indices );
2827 addPreference( tr( "VISU_LOGARITHMIC_SCALING" ), rangeGr, LightApp_Preferences::Bool, "VISU", "scalar_bar_logarithmic" );
2829 int rangetype = addPreference( tr( "VISU_RANGE_TO_USE" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_range_type" );
2831 types.append( tr( "VISU_FIELD_RANGE" ) );
2832 types.append( tr( "VISU_IMPOSED_RANGE" ) );
2834 indices.append( 0 );
2835 indices.append( 1 );
2836 setPreferenceProperty( rangetype, "strings", types );
2837 setPreferenceProperty( rangetype, "indexes", indices );
2839 int imposedGr = addPreference( tr( "VISU_MINMAX_IMPOSED_RANGE" ), sbarTab );
2841 int min = addPreference( tr( "VISU_MIN" ), imposedGr, LightApp_Preferences::DblSpin, "VISU", "scalar_range_min" );
2842 int max = addPreference( tr( "VISU_MAX" ), imposedGr, LightApp_Preferences::DblSpin, "VISU", "scalar_range_max" );
2843 setPreferenceProperty( min, "step", 0.1 );
2844 setPreferenceProperty( max, "step", 0.1 );
2847 int fontGr = addPreference( tr( "VISU_FONT" ), sbarTab );
2848 int tfont = addPreference( tr( "VISU_TITLE" ), fontGr,
2849 LightApp_Preferences::Font, "VISU", "scalar_bar_title_font" );
2850 addPreference( tr( "VISU_TITLE" ), fontGr,
2851 LightApp_Preferences::Color, "VISU", "scalar_bar_title_color" );
2852 int lfont = addPreference( tr( "VISU_LABELS" ), fontGr,
2853 LightApp_Preferences::Font, "VISU", "scalar_bar_label_font" );
2854 addPreference( tr( "VISU_LABELS" ), fontGr,
2855 LightApp_Preferences::Color, "VISU", "scalar_bar_label_color" );
2858 fam.append( tr( "VISU_FONT_ARIAL" ) );
2859 fam.append( tr( "VISU_FONT_COURIER" ) );
2860 fam.append( tr( "VISU_FONT_TIMES" ) );
2861 int wflag = ( QtxListResourceEdit::FontItem::All &
2862 ( ~( QtxListResourceEdit::FontItem::Size |
2863 QtxListResourceEdit::FontItem::UserSize ) ) );
2865 setPreferenceProperty( tfont, "families", fam );
2866 setPreferenceProperty( tfont, "system", false );
2867 setPreferenceProperty( tfont, "widget_flags", wflag );
2868 setPreferenceProperty( lfont, "families", fam );
2869 setPreferenceProperty( lfont, "system", false );
2870 setPreferenceProperty( lfont, "widget_flags", wflag );
2872 // group: "Colors & Labels"
2873 int colorsLabelsGr = addPreference( tr( "VISU_COLORS_AND_LABELS" ), sbarTab );
2875 int numcol = addPreference( tr( "VISU_NB_COLORS" ), colorsLabelsGr,
2876 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_num_colors" );
2877 setPreferenceProperty( numcol, "min", 2 );
2878 setPreferenceProperty( numcol, "max", 256 );
2880 int numlab = addPreference( tr( "VISU_NB_LABELS" ), colorsLabelsGr,
2881 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_num_labels" );
2882 setPreferenceProperty( numlab, "min", 2 );
2883 setPreferenceProperty( numlab, "max", 65 );
2885 // group: "Orientation"
2886 int orientGr = addPreference( tr( "VISU_ORIENTATION" ), sbarTab );
2887 int orient = addPreference( tr( "VISU_ORIENTATION" ), orientGr,
2888 LightApp_Preferences::Selector, "VISU", "scalar_bar_orientation" );
2889 QStringList orients;
2890 orients.append( tr( "VISU_VERTICAL" ) );
2891 orients.append( tr( "VISU_HORIZONTAL" ) );
2893 indices.append( 0 );
2894 indices.append( 1 );
2895 setPreferenceProperty( orient, "strings", orients );
2896 setPreferenceProperty( orient, "indexes", indices );
2898 // group: "Origin & Size Vertical"
2899 int posVSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_VERTICAL" ), sbarTab );
2900 int xv = addPreference( tr( "VISU_X" ), posVSizeGr,
2901 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_x" );
2902 int yv = addPreference( tr( "VISU_Y" ), posVSizeGr,
2903 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_y" );
2904 int wv = addPreference( tr( "VISU_WIDTH" ), posVSizeGr,
2905 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_width" );
2906 int hv = addPreference( tr( "VISU_HEIGHT" ), posVSizeGr,
2907 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_height" );
2908 setPreferenceProperty( xv, "step", 0.1 );
2909 setPreferenceProperty( yv, "step", 0.1 );
2910 setPreferenceProperty( wv, "step", 0.1 );
2911 setPreferenceProperty( hv, "step", 0.1 );
2912 setPreferenceProperty( xv, "min", 0.0 );
2913 setPreferenceProperty( yv, "min", 0.0 );
2914 setPreferenceProperty( wv, "min", 0.0 );
2915 setPreferenceProperty( hv, "min", 0.0 );
2916 setPreferenceProperty( xv, "max", 1.0 );
2917 setPreferenceProperty( yv, "max", 1.0 );
2918 setPreferenceProperty( wv, "max", 1.0 );
2919 setPreferenceProperty( hv, "max", 1.0 );
2921 // group: "Origin & Size Horizontal"
2922 int posHSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_HORIZONTAL" ), sbarTab );
2923 int xh = addPreference( tr( "VISU_X" ), posHSizeGr,
2924 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_x" );
2925 int yh = addPreference( tr( "VISU_Y" ), posHSizeGr,
2926 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_y" );
2927 int wh = addPreference( tr( "VISU_WIDTH" ), posHSizeGr,
2928 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_width" );
2929 int hh = addPreference( tr( "VISU_HEIGHT" ), posHSizeGr,
2930 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_height" );
2931 setPreferenceProperty( xh, "step", 0.1 );
2932 setPreferenceProperty( yh, "step", 0.1 );
2933 setPreferenceProperty( wh, "step", 0.1 );
2934 setPreferenceProperty( hh, "step", 0.1 );
2935 setPreferenceProperty( xh, "min", 0.0 );
2936 setPreferenceProperty( yh, "min", 0.0 );
2937 setPreferenceProperty( wh, "min", 0.0 );
2938 setPreferenceProperty( hh, "min", 0.0 );
2939 setPreferenceProperty( xh, "max", 1.0 );
2940 setPreferenceProperty( yh, "max", 1.0 );
2941 setPreferenceProperty( wh, "max", 1.0 );
2942 setPreferenceProperty( hh, "max", 1.0 );
2944 // group: "Scalar bars default position"
2945 int scalarBarGr = addPreference( tr( "Scalar bars default position" ), sbarTab );
2946 addPreference( tr( "Arrange Scalar Bars" ), scalarBarGr, LightApp_Preferences::Bool, "VISU", "scalar_bars_default_position" );
2948 int srangeTab = addPreference( tr( "Sweep, MED import" ) );
2950 // group: "Sweeping preferences"
2951 int sweepGr = addPreference( tr( "VISU_SWEEPING_PREF" ), srangeTab );
2952 setPreferenceProperty( sweepGr, "columns", 1 );
2954 int timestep = addPreference( tr( "VISU_TIME_STEP" ), sweepGr,
2955 LightApp_Preferences::DblSpin, "VISU", "sweeping_time_step" );
2956 int nbcycles = addPreference( tr( "VISU_NB_CYCLES" ), sweepGr,
2957 LightApp_Preferences::IntSpin, "VISU", "sweeping_number_cycles" );
2958 int nbsteps = addPreference( tr( "VISU_NB_STEPS" ), sweepGr,
2959 LightApp_Preferences::IntSpin, "VISU", "sweeping_number_steps" );
2960 setPreferenceProperty( timestep, "min", 0.1 );
2961 setPreferenceProperty( timestep, "step", 0.1 );
2962 setPreferenceProperty( timestep, "max", 1000 );
2963 setPreferenceProperty( nbcycles, "max", 100 );
2964 setPreferenceProperty( nbsteps, "max", 200 );
2966 // group: "MED files import"
2967 int importGr = addPreference( tr( "MED files import" ), srangeTab );
2968 setPreferenceProperty( importGr, "columns", 1 );
2969 addPreference( tr( "Use build progress" ), importGr, LightApp_Preferences::Bool, "VISU", "use_build_progress" );
2970 addPreference( tr( "Full MED loading" ), importGr, LightApp_Preferences::Bool, "VISU", "full_med_loading" );
2971 addPreference( tr( "Build at once" ), importGr, LightApp_Preferences::Bool, "VISU", "build_at_once" );
2972 addPreference( tr( "Build fields" ), importGr, LightApp_Preferences::Bool, "VISU", "build_fields" );
2973 addPreference( tr( "Build min/max" ), importGr, LightApp_Preferences::Bool, "VISU", "build_min_max" );
2974 addPreference( tr( "Build groups" ), importGr, LightApp_Preferences::Bool, "VISU", "build_groups" );
2975 addPreference( tr( "Close dialog at finish" ), importGr, LightApp_Preferences::Bool, "VISU", "close_at_finish" );
2977 // group: "Representation properties"
2978 int representGr = addPreference( tr( "VISU_PREF_REPRESENT_PROPS" ), srangeTab );
2979 addPreference( tr( "VISU_PREF_SHADING" ), representGr,
2980 LightApp_Preferences::Bool, "VISU", "represent_shading" );
2983 void VisuGUI::preferencesChanged( const QString& a, const QString& b)
2985 if (a != QString("VISU")) return;
2986 if (b == QString("scalar_bar_orientation")) return;
2987 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
2988 float sbX1,sbY1,sbW,sbH;
2989 float aTol = 1.00000009999999;
2990 std::string aWarning;
2991 if(b == QString("scalar_bar_vertical_x") || b == QString("scalar_bar_vertical_width")){
2992 sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_x", sbX1);
2993 sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_width", sbW);
2994 if(sbX1+sbW > aTol){
2995 aWarning = "Origin and Size Vertical: X+Width > 1\n";
2998 aResourceMgr->setValue("VISU", "scalar_bar_vertical_x", sbX1);
2999 aResourceMgr->setValue("VISU", "scalar_bar_vertical_width", sbW);
3002 else if(b == QString("scalar_bar_vertical_y") || b == QString("scalar_bar_vertical_height")){
3003 sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_y", sbY1);
3004 sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_height",sbH);
3005 if(sbY1+sbH > aTol){
3006 aWarning = "Origin and Size Vertical: Y+Height > 1\n";
3009 aResourceMgr->setValue("VISU", "scalar_bar_vertical_y", sbY1);
3010 aResourceMgr->setValue("VISU", "scalar_bar_vertical_height",sbH);
3013 else if(b == QString("scalar_bar_horizontal_x") || b == QString("scalar_bar_horizontal_width")){
3014 sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_x", sbX1);
3015 sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_width", sbW);
3016 if(sbX1+sbW > aTol){
3017 aWarning = "Origin and Size Horizontal: X+Width > 1\n";
3020 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_x", sbX1);
3021 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_width", sbW);
3024 else if(b == QString("scalar_bar_horizontal_y") || b == QString("scalar_bar_horizontal_height")){
3025 sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_y", sbY1);
3026 sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_height",sbH);
3027 if(sbY1+sbH > aTol){
3028 aWarning = "Origin and Size Horizontal: Y+Height > 1\n";
3031 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_y", sbY1);
3032 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_height",sbH);
3035 if (aWarning.size() != 0){
3036 aWarning += "The default values are applied instead.";
3037 SUIT_MessageBox::warn1(GetDesktop(this),
3038 tr("ERR_SCALARBAR_PARAMS"),
3039 tr(aWarning.c_str()),
3046 ::getViewManager(const QString& theType,
3047 const bool theIsCreate)
3049 return getApp()->getViewManager(theType,theIsCreate);
3054 ::getScalarBarsMap()
3056 return myScalarBarsMap;
3058 LightApp_Displayer* VisuGUI::displayer()
3061 myDisplayer = new VisuGUI_Displayer( getApp() );
3067 void VisuGUI::OnPlot3dFromCutPlane()
3069 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
3070 if (CheckLock(aCStudy, GetDesktop(this)))
3073 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
3074 SALOME_ListIO aListIO;
3075 aSelectionMgr->selectedObjects(aListIO);
3077 if (aListIO.Extent() < 1) return;
3080 VISU::CutPlanes_i* aCutPrs = 0;
3081 Handle(SALOME_InteractiveObject) anIO;
3082 _PTR(SObject) aSObject;
3083 SALOME_ListIteratorOfListIO It (aListIO);
3084 for (; It.More(); It.Next()) {
3087 if (!anIO.IsNull() && anIO->hasEntry()) {
3088 aSObject = aCStudy->FindObjectID(anIO->getEntry());
3091 CORBA::Object_var anObject = GetSelectedObj(GetAppStudy(this), anIO->getEntry());
3092 if (!CORBA::is_nil(anObject)) {
3093 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
3094 if (aPrsObject->GetType() == VISU::TCUTPLANES) {
3095 aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
3104 _PTR(SObject) aTimeStampSObj = aSObject->GetFather();
3105 if (SUIT_ViewManager* aViewManager = getApp()->activeViewManager()) {
3106 QString aType = aViewManager->getType();
3107 bool isVVTK = aType == VVTK_Viewer::Type();
3109 Storable::TRestoringMap aMap = getMapOfValue(aTimeStampSObj);
3111 aType = Storable::FindValue(aMap,"myType",&isExist);
3112 if (!isExist || aType.toInt() != TTIMESTAMP )
3115 QString aMeshName = Storable::FindValue(aMap,"myMeshName",&isExist).latin1();
3116 QString anEntity = Storable::FindValue(aMap,"myEntityId",&isExist).latin1();
3117 QString aFieldName = Storable::FindValue(aMap,"myFieldName",&isExist).latin1();
3118 QString aTimeStampId = Storable::FindValue(aMap,"myTimeStampId",&isExist).latin1();
3121 SUIT_ViewWindow* aViewWindow = 0;
3123 aViewWindow = GetViewWindow<VVTK_Viewer>(this);
3124 aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast<VVTK_ViewWindow*>(aViewWindow));
3126 aViewWindow = GetViewWindow<SVTK_Viewer>(this);
3127 aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast<SVTK_ViewWindow*>(GetViewWindow<SVTK_Viewer>(this)));
3129 GetResourceMgr()->setValue("VISU", "scalar_bar_position_num", aPos);
3131 VISU::Plot3D_i* aPrs3d = CreatePrs3d<VISU::Plot3D_i>(this, aTimeStampSObj, aMeshName.latin1(), (Entity)anEntity.toInt(),
3132 aFieldName.latin1(), aTimeStampId.toInt());
3134 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
3135 int aValue = aResourceMgr->integerValue("VISU","BuildDefaultPrs3d",0);
3137 VisuGUI_Plot3DDlg* aDlg = new VisuGUI_Plot3DDlg(this);
3138 aDlg->initFromPrsObject(aPrs3d);
3139 int aOrient = aCutPrs->GetOrientationType(); // Plot3d has the same orientation type
3140 double aRotX = aCutPrs->GetRotateX();
3141 double aRotY = aCutPrs->GetRotateY();
3142 double aPlanePos = aCutPrs->GetPlanePosition(0);
3143 aDlg->setPlane(aOrient, aRotX, aRotY, aPlanePos);
3145 if (!(runAndWait(aDlg, 0) && (aDlg->storeToPrsObject(aPrs3d)))) {
3146 DeletePrs3d(this, aPrs3d, anIO);
3151 UpdateObjBrowser(this, true, aTimeStampSObj);
3153 SVTK_ViewWindow* aSVtkWindow = dynamic_cast<SVTK_ViewWindow*>(aViewWindow);
3154 if ( aSVtkWindow ) {
3155 PublishInView(this, aPrs3d, aSVtkWindow, /*highlight = */true);
3156 aSVtkWindow->onFitAll();
3158 AddScalarBarPosition(this, aSVtkWindow, aPrs3d, aPos);
3162 application()->putInfo(QObject::tr("INF_DONE"));