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 "LightApp_SelectionMgr.h"
77 #include "LightApp_Selection.h"
78 #include "LightApp_Preferences.h"
80 #include "QtxAction.h"
82 #include "VISUConfig.hh"
83 #include "VISU_Gen_i.hh"
84 #include "VISU_Mesh_i.hh"
85 #include "VISU_Table_i.hh"
86 #include "VISU_Result_i.hh"
87 #include "VISU_View_i.hh"
88 #include "VISU_ViewManager_i.hh"
89 #include "VISU_Plot3D_i.hh"
91 #include "VISU_Actor.h"
93 #include "VisuGUI_Prs3dTools.h"
94 #include "VisuGUI_Tools.h"
96 #include "VisuGUI_PopupTools.h"
97 #include "VisuGUI_NameDlg.h"
98 #include "VisuGUI_FileDlg.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 using namespace VISU;
148 static int MYDEBUG = 1;
150 static int MYDEBUG = 0;
153 //////////////////////////////////////////////////
155 //////////////////////////////////////////////////
158 SalomeApp_Module( "VISU" ),
172 if(MYDEBUG) MESSAGE("VisuGUI::OnImportFromFile()");
173 if ( CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)) )
176 VisuGUI_BuildProgressDlg* aBuildProgressDlg = new VisuGUI_BuildProgressDlg( GetDesktop(this) );
177 aBuildProgressDlg->setGenerator( GetVisuGen(this) );
178 aBuildProgressDlg->show();
186 if(MYDEBUG) MESSAGE("VisuGUI::OnExploreMEDFile()");
187 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
188 if ( CheckLock(aStudy,GetDesktop(this)) )
191 SALOME_MED::MED_Gen_var aGen = GetMEDEngine();
194 aFilter.append( tr("FLT_MED_FILES") );
195 aFilter.append( tr("FLT_ALL_FILES") );
197 QFileInfo aFileInfo =
198 SUIT_FileDlg::getFileName(GetDesktop(this),
201 tr("MEN_EXPLORE_MED_FILE"),
203 if(aFileInfo.exists()){
204 application()->putInfo( tr("MEN_EXPLORE_MED_FILE") + " " + aFileInfo.filePath() + "..." );
205 std::string aStudyName = aStudy->Name();
208 aGen->readStructFileWithFieldType(aFileInfo.filePath(),aStudyName.c_str());
212 SUIT_MessageBox::warn1(GetDesktop(this),
214 tr("ERR_ERROR_IN_THE_FILE"),
217 application()->putInfo(aFileInfo.filePath()+tr("INF_DONE"));
218 getApp()->updateObjectBrowser(true); // as need to update MED tree
219 getApp()->updateActions();
226 OnImportTableFromFile()
228 if(MYDEBUG) MESSAGE("VisuGUI::OnImportTableFromFile()");
229 if ( CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)) )
233 aFilter.append( tr("FLT_TABLE_FILES") );
234 aFilter.append( tr("FLT_ALL_FILES") );
236 QFileInfo aFileInfo =
237 SUIT_FileDlg::getFileName(GetDesktop(this),
240 tr("MEN_IMPORT_TABLE"),
242 if (aFileInfo.exists()) {
243 application()->putInfo( tr("MEN_IMPORT_TABLE") + " " + aFileInfo.filePath() + " ..." );
245 CORBA::Object_var anObject = GetVisuGen(this)->ImportTables(aFileInfo.filePath());
247 if (CORBA::is_nil(anObject.in())) {
248 SUIT_MessageBox::warn1(GetDesktop(this),
250 tr("ERR_ERROR_IN_THE_FILE"),
253 application()->putInfo(aFileInfo.filePath()+tr("INF_DONE"));
254 UpdateObjBrowser(this);
261 OnExportTableToFile()
263 if(MYDEBUG) MESSAGE("VisuGUI::OnExportTableToFile()");
265 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
267 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
268 SALOME_ListIO aListIO;
269 aSelectionMgr->selectedObjects(aListIO);
271 if (aListIO.Extent() > 0) {
272 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
273 if (anIO->hasEntry()) {
274 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
277 // find table attribute
279 _PTR(GenericAttribute) anAttr;
281 if (!aSObj->FindAttribute(anAttr, "AttributeTableOfReal")) {
283 if (!aSObj->FindAttribute(anAttr, "AttributeTableOfInteger")) {
284 // if the current SObject is a table title
285 // we take a father contaning the table
286 aSObj = aSObj->GetFather();
288 if (aSObj->FindAttribute(anAttr, "AttributeTableOfReal")) {
291 if (!aSObj->FindAttribute(anAttr, "AttributeTableOfInteger")) {
298 // get table title in order to have default name of the file
301 _PTR(AttributeTableOfReal) aTabAttr (anAttr);
302 if (!aTabAttr) return;
303 aTitle = aTabAttr->GetTitle().c_str();
305 _PTR(AttributeTableOfInteger) aTabAttr (anAttr);
306 if (!aTabAttr) return;
307 aTitle = aTabAttr->GetTitle().c_str();
309 aTitle.simplifyWhiteSpace();
310 aTitle = aTitle.replace(QRegExp(" "), "_").replace(QRegExp("\\*"), "" );
312 // get default path for the file
313 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
314 QString aDir = aResourceMgr->stringValue("VISU","OutputDir","");
315 if (aDir.isEmpty()) {
316 aDir = aResourceMgr->stringValue("VISU","InputDir","");
317 if (aDir.isEmpty()) {
318 aDir = getenv("CSF_PATHData");
321 QString aPath = Qtx::addSlash(aDir) + aTitle;
323 // get name for the file
325 aFilter.append("Table Files (*.xls)");
327 QFileInfo aFileInfo =
328 SUIT_FileDlg::getFileName(GetDesktop(this),
331 tr("MEN_EXPORT_TABLE"), // "Export Table To File"
335 QString aFile = aFileInfo.filePath();
336 if (!aFile.isEmpty()) {
337 application()->putInfo(tr("MEN_EXPORT_TABLE") + " " + aFile + " ...");
338 aDir = Qtx::dir(aFile, true);
339 aResourceMgr->setValue("VISU", "OutputDir", aDir);
342 GetVisuGen(this)->ExportTableToFile(GetSObject(aSObj), aFile.latin1());
343 application()->putInfo(aFile + " " + tr("INF_DONE"));
344 } catch(std::exception& exc) {
346 SUIT_MessageBox::warn1(GetDesktop(this),
348 tr("ERR_ERROR_DURING_EXPORT") + " " + tr(exc.what()),
351 INFOS(tr("ERR_ERROR_DURING_EXPORT"));
352 SUIT_MessageBox::warn1(GetDesktop(this),
354 tr("ERR_ERROR_DURING_EXPORT"),
366 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
367 if (CheckLock(aCStudy,GetDesktop(this)))
369 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
371 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
372 SALOME_ListIO aListIO;
373 aSelectionMgr->selectedObjects(aListIO);
375 SALOME_ListIteratorOfListIO It (aListIO);
376 QApplication::setOverrideCursor(Qt::waitCursor);
377 for (; It.More(); It.Next()) {
378 Handle(SALOME_InteractiveObject) anIO = It.Value();
379 SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
380 if (!aSObject->_is_nil()) {
381 CORBA::Object_var anObject = VISU::SObjectToObject(aSObject);
382 if (!CORBA::is_nil(anObject)) {
383 SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
384 if (!CORBA::is_nil(aMED.in()))
385 GetVisuGen(this)->ImportMed(aSObject);
386 SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject);
387 if (!CORBA::is_nil(aField.in()))
388 GetVisuGen(this)->ImportMedField(aField);
390 SALOMEDS::SObject_var aSFather = aSObject->GetFather();
391 SALOMEDS::GenericAttribute_var anAttr;
392 aSFather->FindAttribute(anAttr, "AttributeName");
393 SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
394 CORBA::String_var aValue = aName->Value();
395 if (strcmp(aValue.in(), "MEDFIELD") == 0)
396 GetVisuGen(this)->ImportMed(aSObject);
400 UpdateObjBrowser(this, true);
401 QApplication::restoreOverrideCursor();
405 CreateCurves( SalomeApp_Module* theModule,
406 VISU::CutLines_i* thePrs,
408 const bool theCreate = true )
412 VisuGUI_CutLinesDlg* aCutDlg = dynamic_cast<VisuGUI_CutLinesDlg*>( theDlg );
416 _PTR(Study) aStudy = GetCStudy( GetAppStudy( theModule ) );
417 _PTR(SObject) aSObject = aStudy->FindObjectID( thePrs->GetEntry().latin1() );
419 if ( !theCreate && aSObject ) {
421 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
422 _PTR(ChildIterator) aIter = aStudy->NewChildIterator(aSObject);
423 for (; aIter->More(); aIter->Next()) {
424 _PTR(SObject) aTblObj = aIter->Value();
426 _PTR(GenericAttribute) anAttr;
427 if (aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
428 aBuilder->RemoveObjectWithChildren( aTblObj ); // We should have only one child
429 UpdateObjBrowser(theModule,true,aTblObj);
436 if ( aCutDlg->isGenerateTable() ) {
437 GetVisuGen( theModule )->CreateTable( thePrs->GetEntry() );
438 if ( aCutDlg->isGenerateCurves() ) {
440 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
441 _PTR(ChildIterator) aIter = aStudy->NewChildIterator(aSObject);
442 for (; aIter->More(); aIter->Next()) {
443 _PTR(SObject) aTblObj = aIter->Value();
445 _PTR(GenericAttribute) anAttr;
446 if ( aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
447 CreatePlot( theModule, aTblObj );
455 if (!theCreate && aSObject) {
456 UpdateObjBrowser(theModule);
464 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
465 if (CheckLock(aStudy,GetDesktop(this)))
468 // Get selected SObject
469 Handle(SALOME_InteractiveObject) anIO;
470 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
471 if (anIO.IsNull() || !anIO->hasEntry())
474 // create a VTK view window if it does not exist
475 GetViewWindow( this, /*create=*/true );
477 CreateMesh(this, anIO);
484 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
485 if (CheckLock(aStudy,GetDesktop(this)))
488 // create a VTK view window if it does not exist
489 GetViewWindow( this, /*create=*/true );
491 // Get selected SObject
492 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
493 SALOME_ListIO aListIO;
494 aSelectionMgr->selectedObjects(aListIO);
495 SALOME_ListIteratorOfListIO anIter (aListIO);
496 for (; anIter.More(); anIter.Next()) {
497 Handle(SALOME_InteractiveObject) anIO = anIter.Value();
498 if (anIO.IsNull() || !anIO->hasEntry())
501 CreateMesh(this, anIO);
509 CreatePrs3d<VISU::ScalarMap_i,VisuGUI_ScalarBarDlg,1>(this);
515 OnCreateDeformedShape()
517 CreatePrs3d<VISU::DeformedShape_i,VisuGUI_DeformedShapeDlg,1>(this);
522 OnCreateScalarMapOnDeformedShape()
524 CreatePrs3d<VISU::ScalarMapOnDeformedShape_i,VisuGUI_ScalarMapOnDeformedShapeDlg,1>(this);
531 CreatePrs3d<VISU::Vectors_i,VisuGUI_VectorsDlg,1>(this);
536 OnCreateIsoSurfaces()
538 CreatePrs3d<VISU::IsoSurfaces_i,VisuGUI_IsoSurfacesDlg,1>(this);
545 CreatePrs3d<VISU::CutPlanes_i,VisuGUI_CutPlanesDlg,0>(this);
552 CreatePrs3d<VISU::CutLines_i,VisuGUI_CutLinesDlg,0>(this);
557 OnCreateStreamLines()
559 CreatePrs3d<VISU::StreamLines_i,VisuGUI_StreamLinesDlg,1>(this);
566 CreatePrs3d<VISU::Plot3D_i,VisuGUI_Plot3DDlg,0>(this);
573 CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this));
574 GetVisuGen( this )->CreateContainer();
575 UpdateObjBrowser(this);
582 if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs");
584 QApplication::setOverrideCursor(Qt::waitCursor);
585 SALOME_ListIO aSel, aList;
586 LightApp_SelectionMgr* mgr = GetSelectionMgr(this);
587 mgr->selectedObjects( aSel );
589 extractContainers( aSel, aList );
591 Handle(SALOME_InteractiveObject) anIO;
592 for ( SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next() ) {
594 CORBA::Object_var anObject = GetSelectedObj( GetAppStudy(this), anIO->getEntry() );
595 if ( !CORBA::is_nil( anObject ) ) {
596 // is it Prs3d object ?
597 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
599 if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs : Prs3d object");
600 //UpdateViewer( this, aPrsObject );
601 SVTK_ViewWindow* vw = GetViewWindow( this, /*create=*/true );
604 displayer()->Display( anIO->getEntry() );
605 vw->highlight(anIO, 1);
610 VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(anObject).in());
612 if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs : Curve object");
613 //PlotCurve( this, aCurve, VISU::eDisplay );
614 displayer()->Display( anIO->getEntry() );
618 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(anObject).in());
620 if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Container object");
621 //PlotContainer( this, aContainer, VISU::eDisplay );
622 displayer()->Display( anIO->getEntry() );
626 VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(anObject).in());
628 if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Table object");
629 //PlotTable( this, aTable, VISU::eDisplay );
630 displayer()->Display( anIO->getEntry() );
635 SVTK_ViewWindow* vw = GetViewWindow( this );
637 vw->getRenderer()->ResetCameraClippingRange();
640 QApplication::restoreOverrideCursor();
655 if(MYDEBUG) MESSAGE("OnErasePrs");
657 QApplication::setOverrideCursor(Qt::waitCursor);
659 SVTK_ViewWindow* vw = GetViewWindow( this );
661 vw->unHighlightAll();
663 SALOME_ListIO aList, aSel;
664 LightApp_SelectionMgr* mgr = GetSelectionMgr(this);
665 mgr->selectedObjects( aSel );
667 extractContainers( aSel, aList );
669 Handle(SALOME_InteractiveObject) anIO;
670 for ( SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next() ) {
672 CORBA::Object_var anObject = GetSelectedObj( GetAppStudy(this), anIO->getEntry() );
673 if (!CORBA::is_nil(anObject))
674 RemoveScalarBarPosition(this,anObject);
675 ErasePrs( this, anObject, false );
681 QApplication::restoreOverrideCursor();
688 startOperation( myEraseAll );
689 if (SVTK_ViewWindow* vw = GetViewWindow(this)) {
690 vw->unHighlightAll();
691 if (vtkRenderer *aRen = vw->getRenderer()) {
693 vtkActorCollection *anActColl = aRen->GetActors();
694 for (anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ) {
695 if (anActor->GetVisibility() > 0)
696 if (VISU_Actor* anVISUActor = VISU_Actor::SafeDownCast(anActor)) {
697 RemoveScalarBarPosition(this,anVISUActor->GetPrs3d());
698 anVISUActor->VisibilityOff();
703 } else if (SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(this, false)) {
713 Handle(SALOME_InteractiveObject) anIO;
714 if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
715 EditPrs3d<VISU::ScalarMap_i, VisuGUI_ScalarBarDlg,1>(this, aPrs3d);
716 if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){
717 aViewWindow->highlight(anIO, 1);
725 OnEditDeformedShape()
727 Handle(SALOME_InteractiveObject) anIO;
728 if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
729 EditPrs3d<VISU::DeformedShape_i, VisuGUI_DeformedShapeDlg,1>(this, aPrs3d);
730 if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){
731 aViewWindow->highlight(anIO, 1);
738 OnEditScalarMapOnDeformedShape()
740 Handle(SALOME_InteractiveObject) anIO;
741 if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
742 EditPrs3d<VISU::ScalarMapOnDeformedShape_i, VisuGUI_ScalarMapOnDeformedShapeDlg,1>(this, aPrs3d);
743 if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
744 aViewWindow->highlight(anIO, 1);
753 Handle(SALOME_InteractiveObject) anIO;
754 if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
755 EditPrs3d<VISU::CutPlanes_i, VisuGUI_CutPlanesDlg,0>(this, aPrs3d);
756 if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){
757 aViewWindow->highlight(anIO, 1);
767 Handle(SALOME_InteractiveObject) anIO;
768 if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
769 EditPrs3d<VISU::CutLines_i, VisuGUI_CutLinesDlg,0>(this, aPrs3d);
770 if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){
771 aViewWindow->highlight(anIO, 1);
781 Handle(SALOME_InteractiveObject) anIO;
782 if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
783 EditPrs3d<VISU::IsoSurfaces_i, VisuGUI_IsoSurfacesDlg,1>(this, aPrs3d);
784 if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){
785 aViewWindow->highlight(anIO, 1);
795 Handle(SALOME_InteractiveObject) anIO;
796 if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
797 EditPrs3d<VISU::Vectors_i, VisuGUI_VectorsDlg,1>(this, aPrs3d);
798 if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){
799 aViewWindow->highlight(anIO, 1);
809 Handle(SALOME_InteractiveObject) anIO;
810 if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
811 EditPrs3d<VISU::StreamLines_i, VisuGUI_StreamLinesDlg,1>(this, aPrs3d);
812 if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){
813 aViewWindow->highlight(anIO, 1);
823 Handle(SALOME_InteractiveObject) anIO;
824 if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
825 EditPrs3d<VISU::Plot3D_i, VisuGUI_Plot3DDlg,0>(this, aPrs3d);
826 if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){
827 aViewWindow->highlight(anIO, 1);
837 ChangeRepresentation(this, VISU::SURFACEFRAME);
844 ChangeRepresentation(this, VISU::INSIDEFRAME);
851 ChangeRepresentation(this, VISU::WIREFRAME);
858 ChangeRepresentation(this, VISU::SHADED);
865 ChangeRepresentation(this, VISU::POINT);
872 ChangeRepresentation(this, VISU::SHRINK);
879 SetShading(this, true);
886 SetShading(this, false);
893 Handle(SALOME_InteractiveObject) anIO;
894 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
895 if (CORBA::is_nil(anObject)) return;
896 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
897 if (!aServant.in()) return;
899 VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
902 SVTK_ViewWindow* vw = GetViewWindow(this);
905 VISU_Actor* anActor = GetActor(aPrs3d, vw);
906 if (!anActor) return;
908 VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
909 VISU::DeformedShape_i* aDeformedShape = dynamic_cast<VISU::DeformedShape_i*>(aPrs3d);
910 SALOMEDS::Color anOldColor, aNewColor;
911 int aRepresent = anActor->GetRepresentation();
913 switch (aRepresent) {
915 anOldColor = aMesh->GetNodeColor();
917 case VISU::WIREFRAME :
918 case VISU::INSIDEFRAME :
919 anOldColor = aMesh->GetLinkColor();
922 case VISU::SURFACEFRAME :
923 anOldColor = aMesh->GetCellColor();
926 } else if (aDeformedShape) {
927 anOldColor = aDeformedShape->GetColor();
932 QColor aColor (int(255*anOldColor.R),
933 int(255*anOldColor.G),
934 int(255*anOldColor.B));
935 QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
936 if (aColorNew.isValid()) {
937 aNewColor.R = aColorNew.red()/255.;
938 aNewColor.G = aColorNew.green()/255.;
939 aNewColor.B = aColorNew.blue()/255.;
941 switch (aRepresent) {
943 aMesh->SetNodeColor(aNewColor);
945 case VISU::WIREFRAME :
946 case VISU::INSIDEFRAME :
947 aMesh->SetLinkColor(aNewColor);
950 case VISU::SURFACEFRAME :
951 aMesh->SetCellColor(aNewColor);
955 aDeformedShape->SetColor(aNewColor);
957 RecreateActor(this, aPrs3d);
963 OnChangeWireframeColor()
965 Handle(SALOME_InteractiveObject) anIO;
966 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
967 if (CORBA::is_nil(anObject)) return;
968 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
969 if (!aServant.in()) return;
971 VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
974 SVTK_ViewWindow* vw = GetViewWindow(this);
977 VISU_Actor* anActor = GetActor(aPrs3d, vw);
978 if (!anActor) return;
980 if (VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d)) {
981 SALOMEDS::Color anOldColor = aMesh->GetLinkColor(), aNewColor;
982 QColor aColor (int(255*anOldColor.R),
983 int(255*anOldColor.G),
984 int(255*anOldColor.B));
985 QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
986 if (aColorNew.isValid()) {
987 aNewColor.R = aColorNew.red()/255.;
988 aNewColor.G = aColorNew.green()/255.;
989 aNewColor.B = aColorNew.blue()/255.;
990 aMesh->SetLinkColor(aNewColor);
991 RecreateActor(this, aMesh);
1000 Handle(SALOME_InteractiveObject) anIO;
1001 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1002 if (CORBA::is_nil(anObject)) return;
1003 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1004 if (!aServant.in()) return;
1006 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
1007 if (!aPrsObject) return;
1009 SVTK_ViewWindow* vw = GetViewWindow(this);
1012 VISU_Actor* anActor = GetActor(aPrsObject, vw);
1013 if (!anActor) return;
1015 VisuGUI_TransparencyDlg* aTransparencyDlg = new VisuGUI_TransparencyDlg( this );
1016 aTransparencyDlg->show();
1023 Handle(SALOME_InteractiveObject) anIO;
1024 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1025 if (CORBA::is_nil(anObject)) return;
1026 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1027 if (!aServant.in()) return;
1029 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
1030 if (!aPrsObject) return;
1032 SVTK_ViewWindow* vw = GetViewWindow(this);
1035 VISU_Actor* anActor = GetActor(aPrsObject, vw);
1036 if (!anActor) return;
1038 VisuGUI_CursorDlg* CursorDlg =
1039 new VisuGUI_CursorDlg (GetDesktop(this), tr("DLG_LINEWIDTH_TITLE"), TRUE);
1041 CursorDlg->Comment1->setText(tr("DLG_LINEWIDTH_CMT1"));
1042 CursorDlg->Comment2->setText(tr("DLG_LINEWIDTH_CMT2"));
1043 CursorDlg->SpinBox1->setMinValue(1);
1044 CursorDlg->SpinBox1->setMaxValue(10);
1046 float oldlwid = anActor->GetLineWidth();
1047 int intlwid = int(oldlwid);
1048 CursorDlg->SpinBox1->setValue(intlwid);
1050 int ret = CursorDlg->exec();
1052 intlwid = CursorDlg->SpinBox1->value();
1053 float newlwid = intlwid;
1054 anActor->SetLineWidth(newlwid);
1063 Handle(SALOME_InteractiveObject) anIO;
1064 CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
1066 if ( !CORBA::is_nil( anObject ) ) {
1067 VISU::Base_var aVisuObj = VISU::Base::_narrow( anObject );
1068 if ( !CORBA::is_nil( aVisuObj ) && aVisuObj->GetType() == VISU::TTABLE ) {
1069 CORBA::Object_ptr aTable = VISU::Table::_narrow( anObject );
1070 if( !CORBA::is_nil( aTable ) ) {
1071 VISU::Table_i* table = dynamic_cast<VISU::Table_i*>( VISU::GetServant(aTable).in() );
1073 SO = GetCStudy( GetAppStudy( this ) )->FindObjectID( table->GetObjectEntry() );
1078 // possibly this is Table SObject
1079 SO = GetCStudy( GetAppStudy( this ) )->FindObjectID( anIO->getEntry() );
1082 if( !IsSObjectTable( SO ) )
1085 VisuGUI_TableDlg* dlg = new VisuGUI_TableDlg( GetDesktop( this ),
1088 //SAL2670 Orientation of show tables
1089 VisuGUI_TableDlg::ttAuto,
1098 Handle(SALOME_InteractiveObject) anIO;
1099 CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
1100 _PTR(Study) aStudy = GetCStudy( GetAppStudy( this ) );
1101 _PTR(SObject) aSObject = aStudy->FindObjectID(anIO->getEntry());
1102 VISU::CutLines_var aCutLines = VISU::CutLines::_narrow( anObject );
1103 if(!aCutLines->_is_nil() || IsSObjectTable(aSObject)) {
1104 GetVisuGen( this )->CreateTable( aSObject->GetID().c_str() );
1105 UpdateObjBrowser(this);
1113 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1114 if (CheckLock(aCStudy,GetDesktop(this)))
1117 SALOME_ListIO aList;
1118 LightApp_SelectionMgr* mgr = GetSelectionMgr(this);
1119 mgr->selectedObjects(aList,QString::null,false);
1120 int i = 0, nbSelected = aList.Extent();
1121 if (nbSelected < 1) return;
1123 const char* entries [nbSelected];
1124 Handle(SALOME_InteractiveObject) anIO;
1125 for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
1127 if (anIO->hasEntry())
1128 entries[i++] = anIO->getEntry();
1131 if (nbSelected < 1) return;
1133 // There is a transaction
1134 _PTR(StudyBuilder) aStudyBuilder = aCStudy->NewBuilder();
1135 aStudyBuilder->NewCommand();
1137 for (i = 0; i < nbSelected; i++) {
1138 _PTR(SObject) aSObject = aCStudy->FindObjectID(entries[i]);
1140 DeleteSObject(this, aCStudy, aSObject);
1141 UpdateObjBrowser(this, true, aSObject);
1145 // Finish transaction
1146 aStudyBuilder->CommitCommand();
1153 Handle(SALOME_InteractiveObject) anIO;
1154 CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
1156 _PTR(GenericAttribute) anAttr;
1157 _PTR(AttributeName) aName;
1159 _PTR(Study) aStudy = GetCStudy( GetAppStudy( this ) );
1161 if ( !CORBA::is_nil( anObject ) ) {
1162 VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
1163 if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TTABLE) {
1164 // Table (VISU object) is selected
1165 CORBA::Object_ptr aTbl = VISU::Table::_narrow( anObject );
1166 if( !CORBA::is_nil( aTbl ) ) {
1167 VISU::Table_i* table = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTbl).in());
1169 _PTR(SObject) SO = aStudy->FindObjectID( table->GetObjectEntry() );
1170 if ( IsSObjectTable(SO) ) {
1171 // get name of SObject
1172 if ( SO->FindAttribute( anAttr, "AttributeName" ) ) {
1174 SOName = QString( aName->Value().c_str() );
1176 VisuGUI_SetupPlot2dDlg* dlg = new VisuGUI_SetupPlot2dDlg( SO, GetDesktop( this ) );
1177 if ( dlg->exec() == QDialog::Accepted ) {
1178 if ( !IsStudyLocked( aStudy ) ) {
1179 // if study is not locked - create new container, create curves and insert them
1180 // into container, then plot container if current viewer is of VIEW_PLOT2D type
1182 QValueList<int> verIndices;
1183 dlg->getCurvesSource( horIndex, verIndices );
1184 if ( horIndex >= 0 && verIndices.count() > 0 ) {
1185 CORBA::Object_var aContainer = GetVisuGen(this)->CreateContainer();
1186 if( !CORBA::is_nil( aContainer ) ) {
1187 VISU::Container_i* pContainer =
1188 dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
1190 for ( int i = 0; i < verIndices.count(); i++ ) {
1191 CORBA::Object_var aNewCurve =
1192 GetVisuGen(this)->CreateCurve( table->_this(), horIndex+1, verIndices[i]+1 );
1193 if( !CORBA::is_nil( aNewCurve ) ) {
1194 VISU::Curve_i* pCrv =
1195 dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aNewCurve).in());
1198 int marker, line, lineWidth;
1200 if ( dlg->getCurveAttributes(verIndices[i], isAuto, marker,
1201 line, lineWidth, color) && !isAuto ) {
1203 c.R = color.red() /255.;
1204 c.G = color.green()/255.;
1205 c.B = color.blue() /255.;
1206 pCrv->SetColor( c );
1207 pCrv->SetMarker( ( VISU::Curve::MarkerType )marker );
1208 pCrv->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1210 pContainer->AddCurve( pCrv->_this() );
1214 UpdateObjBrowser(this);
1215 PlotContainer( this, pContainer, VISU::eDisplay );
1221 // if study is locked just get curves info and plot them
1222 // if current viewer is of VIEW_PLOT2D type
1223 QPtrList<Plot2d_Curve> container;
1224 dlg->getCurves( container );
1225 if ( !container.isEmpty() ) {
1226 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
1227 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( SOName );
1237 else if ( !anIO.IsNull() ) {
1238 // check if Table SObject is selected
1239 SO = aStudy->FindObjectID( anIO->getEntry() );
1240 if ( IsSObjectTable(SO) ) {
1241 // get name of SObject
1242 if ( SO->FindAttribute( anAttr, "AttributeName" ) ) {
1244 SOName = QString( aName->Value().c_str() );
1246 VisuGUI_SetupPlot2dDlg* dlg = new VisuGUI_SetupPlot2dDlg( SO, GetDesktop( this ) );
1247 if ( dlg->exec() == QDialog::Accepted ) {
1248 if ( !IsStudyLocked( aStudy ) ) {
1249 // if study is not locked - create new table and container objects, create curves
1250 // and insert them into container, then plot container if current viewer is of VIEW_PLOT2D type
1252 QValueList<int> verIndices;
1253 dlg->getCurvesSource( horIndex, verIndices );
1254 if ( horIndex >= 0 && verIndices.count() > 0 ) {
1255 CORBA::Object_var aTable = GetVisuGen(this)->CreateTable( SO->GetID().c_str() );
1256 CORBA::Object_var aContainer = GetVisuGen(this)->CreateContainer();
1257 if ( !CORBA::is_nil( aTable ) && !CORBA::is_nil( aContainer ) ) {
1258 VISU::Table_i* pTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTable).in());
1259 VISU::Container_i* pContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
1261 if ( pContainer && pTable ) {
1262 for ( int i = 0; i < verIndices.count(); i++ ) {
1263 CORBA::Object_var aNewCurve = GetVisuGen(this)->CreateCurve
1264 ( pTable->_this(), horIndex+1, verIndices[i]+1 );
1265 if( !CORBA::is_nil( aNewCurve ) ) {
1266 VISU::Curve_i* pCrv = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aNewCurve).in());
1269 int marker, line, lineWidth;
1271 if ( dlg->getCurveAttributes(verIndices[i], isAuto, marker,
1272 line, lineWidth, color) && !isAuto ) {
1274 c.R = color.red()/255.;
1275 c.G = color.green()/255.;
1276 c.B = color.blue()/255.;
1277 pCrv->SetColor( c );
1278 pCrv->SetMarker( ( VISU::Curve::MarkerType )marker );
1279 pCrv->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1281 pContainer->AddCurve( pCrv->_this() );
1285 UpdateObjBrowser(this);
1286 PlotContainer( this, pContainer, VISU::eDisplay );
1291 // if study is locked just get curves info and plot them
1292 QPtrList<Plot2d_Curve> container;
1293 dlg->getCurves( container );
1294 if ( !container.isEmpty() ) {
1295 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
1296 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( SOName );
1309 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1310 SALOME_ListIO aListIO;
1311 aSelectionMgr->selectedObjects(aListIO);
1312 if (aListIO.Extent() != 1) return;
1314 SalomeApp_Study* aAppStudy = GetAppStudy(this);
1315 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1316 CORBA::Object_var anObject = GetSelectedObj( aAppStudy, anIO->getEntry() );
1317 if (CORBA::is_nil( anObject )) return;
1319 VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
1320 if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TCURVE) {
1322 CORBA::Object_ptr aCurve = VISU::Curve::_narrow( anObject );
1323 if( !CORBA::is_nil( aCurve ) ) {
1324 VISU::Curve_i* aDSCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
1325 if ( aDSCurve && (!IsStudyLocked( GetCStudy(aAppStudy) )) ) {
1326 Plot2d_SetupCurveDlg aDlg(GetDesktop( this ));
1328 aDlg.setLine( (int)aDSCurve->GetLine(), aDSCurve->GetLineWidth() );
1329 aDlg.setMarker( (int)aDSCurve->GetMarker() );
1330 SALOMEDS::Color aColor = aDSCurve->GetColor();
1331 aDlg.setColor( QColor( (int)(aColor.R*255.), (int)(aColor.G*255.), (int)(aColor.B*255.) ) );
1332 if( aDlg.exec() == QDialog::Accepted ) {
1333 aDSCurve->SetLine( (VISU::Curve::LineType)aDlg.getLine(), aDlg.getLineWidth() );
1334 aDSCurve->SetMarker( (VISU::Curve::MarkerType)aDlg.getMarker());
1335 SALOMEDS::Color newColor;
1336 newColor.R = aDlg.getColor().red()/255.;
1337 newColor.G = aDlg.getColor().green()/255.;
1338 newColor.B = aDlg.getColor().blue()/255.;
1339 aDSCurve->SetColor( newColor );
1340 PlotCurve(this, aDSCurve, VISU::eDisplay);
1351 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1352 if (CheckLock(aCStudy,GetDesktop(this)))
1354 Handle(SALOME_InteractiveObject) anIO;
1355 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1356 if (anIO.IsNull() || CORBA::is_nil(anObject))
1359 VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
1360 if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TCONTAINER) {
1362 CORBA::Object_ptr aCnt = VISU::Container::_narrow(anObject);
1363 if (!CORBA::is_nil(aCnt)) {
1364 VISU::Container_i* container = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aCnt).in());
1365 if (container && container->GetNbCurves() > 0) {
1367 UpdateObjBrowser(this);
1377 Handle(SALOME_InteractiveObject) anIO;
1378 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1379 if (CORBA::is_nil(anObject)) return;
1381 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1382 if (!aServant.in()) return;
1383 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aServant.in());
1384 if (!aContainer) return;
1386 VisuGUI_EditContainerDlg* aDlg = new VisuGUI_EditContainerDlg (this);
1387 aDlg->initFromPrsObject(aContainer);
1389 aDlg->storeToPrsObject(aContainer);
1390 UpdateObjBrowser(this, true);
1399 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1400 if (CheckLock(aCStudy,GetDesktop(this)))
1403 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
1404 if (aViewMgr->getType() != SVTK_Viewer::Type())
1407 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1408 SALOME_ListIO aListIO;
1409 aSelectionMgr->selectedObjects(aListIO);
1410 if (aListIO.Extent() > 1)
1413 if (aListIO.Extent() == 0) {
1414 VISU::View3D_i::SaveViewParams(aViewMgr, VISU::View3D_i::GenerateViewParamsName().latin1());
1416 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1417 VISU::View3D_i::SaveViewParams(aViewMgr, anIO->getName());
1419 UpdateObjBrowser(this);
1424 OnRestoreViewParams()
1426 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
1427 if (aViewMgr->getType() != SVTK_Viewer::Type())
1430 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1431 SALOME_ListIO aListIO;
1432 aSelectionMgr->selectedObjects(aListIO);
1433 if (aListIO.Extent() != 1)
1436 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1437 //jfa tmp:VISU::View3D_i::RestoreViewParams(aViewMgr, anIO->getName());
1438 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));//jfa tmp
1439 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());//jfa tmp
1440 VISU::View3D_i::RestoreViewParams(aViewMgr, aSObj->GetName().c_str());//jfa tmp
1447 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1448 if (CheckLock(aCStudy,GetDesktop(this)))
1451 Handle(SALOME_InteractiveObject) anIO;
1452 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1454 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
1457 //TEST DU PARENT == VISU
1458 _PTR(StudyBuilder) aBuilder = aCStudy->NewBuilder();
1459 _PTR(GenericAttribute) anAttr = aBuilder->FindOrCreateAttribute(aSObj, "AttributeName");
1461 _PTR(AttributeName) aName (anAttr);
1462 QString Name = VisuGUI_NameDlg::getName( GetDesktop( this ), aName->Value().c_str() );
1463 if (!Name.isEmpty()) {
1464 QApplication::setOverrideCursor(Qt::waitCursor);
1466 // rename specific objects
1467 if (!CORBA::is_nil(anObject)) {
1468 VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
1469 if (!CORBA::is_nil(aVisuObj)) {
1470 switch (aVisuObj->GetType()) {
1471 case VISU::TCURVE: // Curve object
1473 CORBA::Object_ptr aCurve = VISU::Curve::_narrow(anObject);
1474 if (!CORBA::is_nil(aCurve)) {
1475 VISU::Curve_i* curve =
1476 dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
1478 curve->SetName(Name.latin1());
1482 case VISU::TTABLE: // Table object
1484 CORBA::Object_ptr aTable = VISU::Table::_narrow(anObject);
1485 if (!CORBA::is_nil(aTable)) {
1486 VISU::Table_i* table =
1487 dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTable).in());
1489 table->SetName(Name.latin1());
1493 case VISU::TCONTAINER: // Container object
1495 CORBA::Object_ptr aContainer = VISU::Container::_narrow(anObject);
1496 if (!CORBA::is_nil(aContainer)) {
1497 VISU::Container_i* container =
1498 dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
1500 container->SetName(Name.latin1());
1511 // rename the study object
1512 aName->SetValue(Name.latin1()); // rename the SObject
1513 anIO->setName(Name.latin1()); // rename the InteractiveObject
1515 ViewManagerList pvm_list;
1516 getApp()->viewManagers( SPlot2d_Viewer::Type(), pvm_list );
1517 for( SUIT_ViewManager* mgr = pvm_list.first(); mgr; mgr = pvm_list.next() )
1519 Plot2d_ViewManager* pvm = dynamic_cast<Plot2d_ViewManager*>( mgr );
1522 SPlot2d_Viewer* pv = dynamic_cast<SPlot2d_Viewer*>( pvm->getViewModel() );
1524 pv->renameAll( anIO, Name.latin1() );
1528 UpdateObjBrowser(this, false);
1530 QApplication::restoreOverrideCursor();
1539 new VisuGUI_ClippingDlg (this, "", false);
1547 Handle(SALOME_InteractiveObject) anIO;
1548 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1549 if (CORBA::is_nil(anObject)) return;
1550 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1551 if (!aServant.in()) return;
1553 VISU::ScalarMap_i* aPrsObject = dynamic_cast<VISU::ScalarMap_i*>(aServant.in());
1554 if (!aPrsObject) return;
1556 SVTK_ViewWindow* vw = GetViewWindow(this);
1559 VISU_Actor* aActor = GetActor(aPrsObject, vw);
1560 if (!aActor) return;
1562 if (!aActor->GetVisibility()) {
1563 aActor->VisibilityOn();
1566 // Get sweep parameters
1567 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
1569 double aTempoDbl = aResourceMgr->doubleValue("VISU", "sweeping_time_step", 0.1);
1570 int aTemp = int(1.E6 * aTempoDbl);
1572 int aCycles = aResourceMgr->integerValue("VISU", "sweeping_number_cycles", 1);
1573 int aSteps = aResourceMgr->integerValue("VISU", "sweeping_time_step", 40);
1576 QApplication::setOverrideCursor(Qt::waitCursor);
1577 for (int j = 0; j < aCycles; j++) {
1578 for (int i = 0; i <= aSteps; i++) {
1580 float aPercents = float(i)/aSteps;
1581 aPrsObject->SetMapScale(aPercents);
1582 aPrsObject->UpdateActor(aActor);
1583 vw->getRenderWindow()->Render();
1585 } catch (std::exception& exc) {
1586 INFOS("Follow exception was occured :\n" << exc.what());
1588 INFOS("Unknown exception was occured!");
1592 QApplication::restoreOverrideCursor();
1599 if(!VISU::GetViewWindow(this))
1602 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1603 VisuGUI_TimeAnimationDlg* aAnimationDlg =
1604 new VisuGUI_TimeAnimationDlg (this, aCStudy);
1606 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1607 SALOME_ListIO aListIO;
1608 aSelectionMgr->selectedObjects(aListIO);
1610 bool isDefined = false;
1612 SALOME_ListIteratorOfListIO It (aListIO);
1613 for (; It.More(); It.Next()) {
1614 _PTR(SObject) aSObject = aCStudy->FindObjectID(It.Value()->getEntry());
1615 if (!aSObject) continue;
1616 if (getValue(aSObject, "myComment") == QString("FIELD")) {
1617 long aNumber = getValue(aSObject, "myNbTimeStamps").toLong();
1621 aAnimationDlg->addField(aSObject);
1623 } else if (aNbTimes == aNumber) {
1624 aAnimationDlg->addField(aSObject);
1629 if (isDefined) aAnimationDlg->show();
1630 else delete aAnimationDlg;
1633 //************************************************************************
1638 if(!VISU::GetViewWindow(this))
1641 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1642 SALOME_ListIO aListIO;
1643 aSelectionMgr->selectedObjects(aListIO);
1645 if (aListIO.Extent() != 1)
1648 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1650 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1652 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
1655 VISU::Storable::TRestoringMap aMap;
1656 _PTR(GenericAttribute) anAttr;
1657 if (!aSObj->FindAttribute(anAttr, "AttributeComment")) return;
1659 _PTR(AttributeComment) aComment (anAttr);
1660 string aComm = aComment->Value();
1661 QString strIn (aComm.c_str());
1662 VISU::Storable::StrToMap(strIn, aMap);
1664 VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
1665 if (aType != VISU::TANIMATION) return;
1667 VisuGUI_TimeAnimationDlg* aAnimationDlg =
1668 new VisuGUI_TimeAnimationDlg(this, aCStudy);
1669 aAnimationDlg->restoreFromStudy(aSObj);
1670 aAnimationDlg->show();
1675 OnCopyPresentation()
1677 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1678 if (CheckLock(aCStudy,GetDesktop(this)))
1681 Handle(SALOME_InteractiveObject) anIO;
1682 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1683 if (CORBA::is_nil(anObject)) return;
1684 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1685 if (!aServant.in()) return;
1687 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
1688 if (!aPrsObject) return;
1690 switch (aPrsObject->GetType()) {
1693 VISU::Mesh_i* aMeshPrs = dynamic_cast<VISU::Mesh_i*>(aPrsObject);
1694 VISU::Mesh_i* aSameMesh = new VISU::Mesh_i(aMeshPrs->GetResult());
1695 aSameMesh->SameAs(aMeshPrs);
1696 UpdateViewer(this, aSameMesh);
1699 case VISU::TSCALARMAP:
1701 VISU::ScalarMap_i* aScalarPrs = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
1702 VISU::ScalarMap_i* aSameScalar = new VISU::ScalarMap_i(aScalarPrs->GetResult(),true);
1703 aSameScalar->SameAs(aScalarPrs);
1704 UpdateViewer(this, aSameScalar);
1707 case VISU::TDEFORMEDSHAPE:
1709 VISU::DeformedShape_i* aDefPrs = dynamic_cast<VISU::DeformedShape_i*>(aPrsObject);
1710 VISU::DeformedShape_i* aSameDeformed = new VISU::DeformedShape_i(aDefPrs->GetResult(),true);
1711 aSameDeformed->SameAs(aDefPrs);
1712 UpdateViewer(this, aSameDeformed);
1715 case VISU::TSCALARMAPONDEFORMEDSHAPE:
1717 VISU::ScalarMapOnDeformedShape_i* aDefPrs = dynamic_cast<VISU::ScalarMapOnDeformedShape_i*>(aPrsObject);
1718 VISU::ScalarMapOnDeformedShape_i* aSameScalarMapOnDeformed = new VISU::ScalarMapOnDeformedShape_i(aDefPrs->GetResult(),true);
1719 aSameScalarMapOnDeformed->SameAs(aDefPrs);
1720 UpdateViewer(this, aSameScalarMapOnDeformed);
1723 case VISU::TCUTPLANES:
1725 VISU::CutPlanes_i* aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
1726 VISU::CutPlanes_i* aSameCut = new VISU::CutPlanes_i(aCutPrs->GetResult(),true);
1727 aSameCut->SameAs(aCutPrs);
1728 UpdateViewer(this, aSameCut);
1731 case VISU::TCUTLINES:
1733 VISU::CutLines_i* aCutPrs = dynamic_cast<VISU::CutLines_i*>(aPrsObject);
1734 VISU::CutLines_i* aSameCut = new VISU::CutLines_i(aCutPrs->GetResult(),true);
1735 aSameCut->SameAs(aCutPrs);
1736 UpdateViewer(this, aSameCut);
1739 case VISU::TISOSURFACE:
1741 VISU::IsoSurfaces_i* aIsoPrs = dynamic_cast<VISU::IsoSurfaces_i*>(aPrsObject);
1742 VISU::IsoSurfaces_i* aSameIso = new VISU::IsoSurfaces_i(aIsoPrs->GetResult(),true);
1743 aSameIso->SameAs(aIsoPrs);
1744 UpdateViewer(this, aSameIso);
1747 case VISU::TSTREAMLINES:
1749 VISU::StreamLines_i* aLinesPrs = dynamic_cast<VISU::StreamLines_i*>(aPrsObject);
1750 VISU::StreamLines_i* aSameLines = new VISU::StreamLines_i(aLinesPrs->GetResult(),true);
1751 aSameLines->SameAs(aLinesPrs);
1752 UpdateViewer(this, aSameLines);
1755 case VISU::TVECTORS:
1757 VISU::Vectors_i* aVectorsPrs = dynamic_cast<VISU::Vectors_i*>(aPrsObject);
1758 VISU::Vectors_i* aSameVectors = new VISU::Vectors_i(aVectorsPrs->GetResult(),true);
1759 aSameVectors->SameAs(aVectorsPrs);
1760 UpdateViewer(this, aSameVectors);
1765 VISU::Plot3D_i* aPlot3DPrs = dynamic_cast<VISU::Plot3D_i*>(aPrsObject);
1766 VISU::Plot3D_i* aSamePlot3D = new VISU::Plot3D_i(aPlot3DPrs->GetResult());
1767 aSamePlot3D->SameAs(aPlot3DPrs);
1768 UpdateViewer(this, aSamePlot3D);
1772 UpdateObjBrowser(this);
1779 if (GetViewWindow(this))
1780 (new VisuGUI_SelectionDlg(this))->show();
1782 SUIT_MessageBox::warn1(GetDesktop(this),
1784 tr("ERR_ACTIVATE_VIEW3D"),
1792 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1793 SALOME_ListIO aListIO;
1794 aSelectionMgr->selectedObjects(aListIO);
1796 SALOME_ListIteratorOfListIO It (aListIO);
1798 // first find the bounds
1799 double aMin, aMax; bool first = true;
1800 for (; It.More(); It.Next()) {
1801 Handle(SALOME_InteractiveObject)& anIO = It.Value();
1802 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
1803 if (!aPrsList.empty()) {
1804 for (int i = 0, n = aPrsList.size(); i < n; i++) {
1805 VISU::Prs3d_i* aPrsObject = aPrsList[i];
1807 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
1811 aMin = aScalar->GetMin(); aMax = aScalar->GetMax();
1813 if (aScalar->GetMin() < aMin) aMin = aScalar->GetMin();
1814 if (aScalar->GetMax() > aMax) aMax = aScalar->GetMax();
1822 // set the computed range to every selected ScalarMap
1823 bool update = false;
1824 for (It.Initialize(aListIO); It.More(); It.Next() ) {
1825 Handle(SALOME_InteractiveObject)& anIO = It.Value();
1826 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
1827 if (!aPrsList.empty()) {
1828 for (int i = 0, n = aPrsList.size(); i < n; i++) {
1829 VISU::Prs3d_i* aPrsObject = aPrsList[i];
1831 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
1833 aScalar->SetRange(aMin, aMax);
1834 RecreateActor(this, aScalar);
1842 if (SVTK_ViewWindow* vw = GetViewWindow(this)) {
1843 //if (vw->getRenderer()->GetActors()->GetNumberOfItems() > 0) {
1844 vw->getRenderer()->ResetCameraClippingRange();
1855 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1856 SALOME_ListIO aListIO;
1857 aSelectionMgr->selectedObjects(aListIO);
1859 SALOME_ListIteratorOfListIO It (aListIO);
1861 // restore the source range for every ScalarMap
1862 bool update = false;
1863 for (; It.More(); It.Next()) {
1864 Handle(SALOME_InteractiveObject)& anIO = It.Value();
1865 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
1866 if (!aPrsList.empty()) {
1867 for (int i = 0, n = aPrsList.size(); i < n; i++) {
1868 VISU::Prs3d_i* aPrsObject = aPrsList[i];
1870 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
1872 aScalar->SetSourceRange();
1873 RecreateActor(this, aScalar);
1881 if (SVTK_ViewWindow* vw = GetViewWindow(this)) {
1882 //if (vw->getRenderer()->GetActors()->GetNumberOfItems() > 0) {
1883 vw->getRenderer()->ResetCameraClippingRange();
1894 if(MYDEBUG) MESSAGE("VisuGUI::OnTranslatePrs");
1895 VisuGUI_OffsetDlg* aDlg = new VisuGUI_OffsetDlg (this);
1897 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1899 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1900 SALOME_ListIO aListIO;
1901 aSelectionMgr->selectedObjects(aListIO);
1903 SALOME_ListIteratorOfListIO It (aListIO);
1904 for (; It.More(); It.Next()) {
1905 Handle(SALOME_InteractiveObject)& anIO = It.Value();
1906 if (anIO->hasEntry()) {
1907 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
1909 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSObject);
1910 if (!CORBA::is_nil(aCORBAObject)) {
1911 PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
1912 if (VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in())) {
1913 aDlg->addPresentation(aPrsObject);
1919 if (aDlg->getPrsCount() > 0)
1929 SVTK_ViewWindow* vw = GetViewWindow(this);
1931 ArrangeDlg* aDlg = new ArrangeDlg (GetDesktop(this), vw);
1940 initialize( CAM_Application* theApp )
1942 SalomeApp_Module::initialize( theApp );
1955 QWidget* aParent = application()->desktop();
1956 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
1959 createAction( VISU_IMPORT_FROM_FILE, "", QIconSet(),
1960 tr("MEN_IMPORT_FROM_FILE"), "", (CTRL + Key_I), aParent, false,
1961 this, SLOT(OnImportFromFile()));
1963 createAction( VISU_EXPLORE_MED, "", QIconSet(),
1964 tr("MEN_EXPLORE_MED_FILE"), "", (CTRL + Key_M), aParent, false,
1965 this, SLOT(OnExploreMEDFile()));
1967 createAction( VISU_IMPORT_TABLE, "", QIconSet(),
1968 tr("MEN_IMPORT_TABLE"), "", 0, aParent, false,
1969 this, SLOT(OnImportTableFromFile()));
1971 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP"));
1972 createAction( VISU_SCALAR_MAP, tr("MEN_SCALAR_MAP"), QIconSet(aPixmap),
1973 tr("MEN_SCALAR_MAP"), "", 0, aParent, false,
1974 this, SLOT(OnCreateScalarMap()));
1976 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_DEFORMED_SHAPE"));
1977 createAction( VISU_DEFORMED_SHAPE, tr("MEN_DEFORMED_SHAPE"), QIconSet(aPixmap),
1978 tr("MEN_DEFORMED_SHAPE"), "", 0, aParent, false,
1979 this, SLOT(OnCreateDeformedShape()));
1981 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP_ON_DEFORMED_SHAPE"));
1982 createAction( VISU_SCALAR_MAP_ON_DEFORMED_SHAPE, tr("MEN_SCALAR_MAP_ON_DEFORMED_SHAPE"), QIconSet(aPixmap),
1983 tr("MEN_SCALAR_MAP_ON_DEFORMED_SHAPE"), "", 0, aParent, false,
1984 this, SLOT(OnCreateScalarMapOnDeformedShape()));
1986 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_VECTORS"));
1987 createAction( VISU_VECTORS, tr("MEN_VECTORS"), QIconSet(aPixmap),
1988 tr("MEN_VECTORS"), "", 0, aParent, false,
1989 this, SLOT(OnCreateVectors()));
1991 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ISO_SURFACES"));
1992 createAction( VISU_ISO_SURFACES, tr("MEN_ISO_SURFACES"), QIconSet(aPixmap),
1993 tr("MEN_ISO_SURFACES"), "", 0, aParent, false,
1994 this, SLOT(OnCreateIsoSurfaces()));
1996 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_PLANES"));
1997 createAction( VISU_CUT_PLANES, tr("MEN_CUT_PLANES"), QIconSet(aPixmap),
1998 tr("MEN_CUT_PLANES"), "", 0, aParent, false,
1999 this, SLOT(OnCreateCutPlanes()));
2001 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_STREAM_LINES"));
2002 createAction( VISU_STREAM_LINES, tr("MEN_STREAM_LINES"), QIconSet(aPixmap),
2003 tr("MEN_STREAM_LINES"), "", 0, aParent, false,
2004 this, SLOT(OnCreateStreamLines()));
2006 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_LINES"));
2007 createAction( VISU_CUT_LINES, tr("MEN_CUT_LINES"), QIconSet(aPixmap),
2008 tr("MEN_CUT_LINES"), "", 0, aParent, false,
2009 this, SLOT(OnCreateCutLines()));
2011 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT_3D"));
2012 createAction( VISU_PLOT_3D, tr("MEN_PLOT_3D"), QIconSet(aPixmap),
2013 tr("MEN_PLOT_3D"), "", 0, aParent, false,
2014 this, SLOT(OnCreatePlot3D()));
2016 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT2D"));
2017 createAction( VISU_PLOT2D, tr("MEN_CREATE_PLOT2D"), QIconSet(aPixmap),
2018 tr("MEN_CREATE_PLOT2D"), "", 0, aParent, false,
2019 this, SLOT(OnCreatePlot2dView()));
2021 createAction( VISU_DELETE_OBJS, tr("MEN_DELETE_OBJS"), QIconSet(),
2022 tr("MEN_DELETE_OBJS"), "", 0, aParent, false,
2023 this, SLOT(OnDeleteObjects()));
2025 createAction( VISU_SHOW_TABLE, tr("MEN_SHOW_TABLE"), QIconSet(),
2026 tr("MEN_SHOW_TABLE"), "", 0, aParent, false,
2027 this, SLOT(OnShowTable()));
2029 createAction( VISU_CREATE_CURVES, tr("MEN_CREATE_CURVES"), QIconSet(),
2030 tr("MEN_CREATE_CURVES"), "", 0, aParent, false,
2031 this, SLOT(OnPlotData()));
2033 createAction( VISU_EXPORT_TABLE, tr("MEN_EXPORT_TABLE"), QIconSet(),
2034 tr("MEN_EXPORT_TABLE"), "", 0, aParent, false,
2035 this, SLOT(OnExportTableToFile()));
2037 createAction( VISU_IMPORT_MED_STRUCTURE, tr("MEN_IMPORT_MED_STRUCTURE"), QIconSet(),
2038 tr("MEN_IMPORT_MED_STRUCTURE"), "", 0, aParent, false,
2039 this, SLOT(OnImportMedField()));
2041 createAction( VISU_IMPORT_MED_TIMESTAMP, tr("MEN_IMPORT_MED_TIMESTAMP"), QIconSet(),
2042 tr("MEN_IMPORT_MED_TIMESTAMP"), "", 0, aParent, false,
2043 this, SLOT(OnImportMedField()));
2045 createAction( VISU_IMPORT_MED_FIELD, tr("MEN_IMPORT_MED_FIELD"), QIconSet(),
2046 tr("MEN_IMPORT_MED_FIELD"), "", 0, aParent, false,
2047 this, SLOT(OnImportMedField()));
2049 createAction( VISU_CREATE_PRS, tr("MEN_CREATE_PRS"), QIconSet(),
2050 tr("MEN_CREATE_PRS"), "", 0, aParent, false,
2051 this, SLOT(OnCreateMesh()));
2053 createAction( VISU_CREATE_MANY_PRS, tr("MEN_CREATE_MANY_PRS"), QIconSet(),
2054 tr("MEN_CREATE_MANY_PRS"), "", 0, aParent, false,
2055 this, SLOT(OnCreateManyMesh()));
2057 createAction( VISU_TRANSLATE_PRS, tr("MEN_TRANSLATE_PRS"), QIconSet(),
2058 tr("MEN_TRANSLATE_PRS"), "", 0, aParent, false,
2059 this, SLOT(OnTranslatePrs()));
2061 createAction( VISU_MERGE_SCALAR_BARS, tr("MEN_MERGE_SCALAR_BARS"), QIconSet(),
2062 tr("MEN_MERGE_SCALAR_BARS"), "", 0, aParent, false,
2063 this, SLOT(OnMergeScalarBars()));
2065 createAction( VISU_FREE_SCALAR_BARS, tr("MEN_FREE_SCALAR_BARS"), QIconSet(),
2066 tr("MEN_FREE_SCALAR_BARS"), "", 0, aParent, false,
2067 this, SLOT(OnFreeScalarBars()));
2069 createAction( VISU_ERASE, tr("MEN_ERASE"), QIconSet(),
2070 tr("MEN_ERASE"), "", 0, aParent, false,
2071 this, SLOT(OnErasePrs()));
2073 createAction( VISU_DISPLAY, tr("MEN_DISPLAY"), QIconSet(),
2074 tr("MEN_DISPLAY"), "", 0, aParent, false,
2075 this, SLOT(OnDisplayPrs()));
2077 createAction( VISU_DISPLAY_ONLY, tr("MEN_DISPLAY_ONLY"), QIconSet(),
2078 tr("MEN_DISPLAY_ONLY"), "", 0, aParent, false,
2079 this, SLOT(OnDisplayOnlyPrs()));
2081 createAction( VISU_COPY_PRS, tr("MEN_COPY_PRS"), QIconSet(),
2082 tr("MEN_COPY_PRS"), "", 0, aParent, false,
2083 this, SLOT(OnCopyPresentation()));
2085 createAction( VISU_CURVE_PROPS, tr("MEN_CURVE_PROPS"), QIconSet(),
2086 tr("MEN_CURVE_PROPS"), "", 0, aParent, false,
2087 this, SLOT(OnCurveProperties()));
2089 createAction( VISU_RENAME, tr("MEN_RENAME"), QIconSet(), tr("MEN_RENAME"), "", 0, aParent, false,
2090 this, SLOT(OnRename()));
2092 createAction( VISU_EDIT_CONTAINER, tr("MEN_EDIT_CONTAINER"), QIconSet(),
2093 tr("MEN_EDIT_CONTAINER"), "", 0, aParent, false,
2094 this, SLOT(OnEditContainer()));
2096 createAction( VISU_CLEAR_CONTAINER, tr("MEN_CLEAR_CONTAINER"), QIconSet(),
2097 tr("MEN_CLEAR_CONTAINER"), "", 0, aParent, false,
2098 this, SLOT(OnClearContainer()));
2100 createAction( VISU_SAVE_VIEW_PARAMS, tr("MEN_SAVE_VIEWPARAMS"), QIconSet(),
2101 tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
2102 this, SLOT(OnSaveViewParams()));
2103 createAction( VISU_SAVE_VIEW_PARAMS_1, tr("MEN_SAVE_VIEWPARAMS"), QIconSet(),
2104 tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
2105 this, SLOT(OnSaveViewParams()));
2107 createAction( VISU_RESTORE_VIEW_PARAMS, tr("MEN_RESTORE_VIEWPARAMS"), QIconSet(),
2108 tr("MEN_RESTORE_VIEWPARAMS"), "", 0, aParent, false,
2109 this, SLOT(OnRestoreViewParams()));
2111 //createAction( VISU_DELETE_VIEW_PARAMS, tr("MEN_DELETE_VIEWPARAMS"), QIconSet(),
2112 // tr("MEN_DELETE_VIEWPARAMS"), "", 0, aParent, false,
2113 // this, SLOT(OnDeleteObjects()));
2115 createAction( VISU_ARRANGE_ACTORS, tr("MEN_ARRANGE_ACTORS"), QIconSet(),
2116 tr("MEN_ARRANGE_ACTORS"), "", 0, aParent, false,
2117 this, SLOT(OnArrangeActors()));
2119 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_POINTS"));
2120 createAction( VISU_POINTS, tr("MEN_POINTS"), QIconSet(aPixmap),
2121 tr("MEN_POINTS"), "", 0, aParent, false,
2122 this, SLOT(OnMakePoints()));
2124 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_WIREFRAME"));
2125 createAction( VISU_WIREFRAME, tr("MEN_WIREFRAME"), QIconSet(aPixmap),
2126 tr("MEN_WIREFRAME"), "", 0, aParent, false,
2127 this, SLOT(OnMakeWireframe()));
2129 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SURFACE"));
2130 createAction( VISU_SURFACE, tr("MEN_SURFACE"), QIconSet(aPixmap),
2131 tr("MEN_SURFACE"), "", 0, aParent, false,
2132 this, SLOT(OnMakeSurface()));
2134 createAction( VISU_INSIDEFRAME, tr("MEN_INSIDEFRAME"), QIconSet(),
2135 tr("MEN_INSIDEFRAME"), "", 0, aParent, false,
2136 this, SLOT(OnMakeInsideframe()));
2138 createAction( VISU_SURFACEFRAME, tr("MEN_SURFACEFRAME"), QIconSet(),
2139 tr("MEN_SURFACEFRAME"), "", 0, aParent, false,
2140 this, SLOT(OnMakeSurfaceframe()));
2142 createAction( VISU_SHRINK, tr("MEN_SHRINK"), QIconSet(),
2143 tr("MEN_SHRINK"), "", 0, aParent, false,
2144 this, SLOT(OnMakeShrink()));
2146 createAction( VISU_UNSHRINK, tr("MEN_UNSHRINK"), QIconSet(),
2147 tr("MEN_UNSHRINK"), "", 0, aParent, false,
2148 this, SLOT(OnMakeShrink()));
2150 createAction( VISU_SHADING, tr("MEN_SHADING"), QIconSet(),
2151 tr("MEN_SHADING"), "", 0, aParent, false,
2152 this, SLOT(OnSetShadingOn()));
2154 createAction( VISU_NOSHADING, tr("MEN_NOSHADING"), QIconSet(),
2155 tr("MEN_NOSHADING"), "", 0, aParent, false,
2156 this, SLOT(OnSetShadingOff()));
2158 createAction( VISU_CELL_COLOR, tr("MEN_CELL_COLOR"), QIconSet(),
2159 tr("MEN_CELL_COLOR"), "", 0, aParent, false,
2160 this, SLOT(OnChangeColor()));
2162 createAction( VISU_COLOR, tr("MEN_COLOR"), QIconSet(),
2163 tr("MEN_COLOR"), "", 0, aParent, false,
2164 this, SLOT(OnChangeColor()));
2166 createAction( VISU_EDGE_COLOR, tr("MEN_EDGE_COLOR"), QIconSet(),
2167 tr("MEN_EDGE_COLOR"), "", 0, aParent, false,
2168 this, SLOT(OnChangeWireframeColor()));
2170 createAction( VISU_OPACITY, tr("MEN_OPACITY"), QIconSet(),
2171 tr("MEN_OPACITY"), "", 0, aParent, false,
2172 this, SLOT(OnChangeOpacity()));
2174 createAction( VISU_LINE_WIDTH, tr("MEN_LINE_WIDTH"), QIconSet(),
2175 tr("MEN_LINE_WIDTH"), "", 0, aParent, false,
2176 this, SLOT(OnChangeLines()));
2179 createAction( VISU_EDIT_SCALARMAP, tr("MEN_EDIT_PRS"), QIconSet(),
2180 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2181 this, SLOT(OnEditScalarMap()));
2183 createAction( VISU_EDIT_DEFORMEDSHAPE, tr("MEN_EDIT_PRS"), QIconSet(),
2184 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2185 this, SLOT(OnEditDeformedShape()));
2187 createAction( VISU_EDIT_CUTPLANES, tr("MEN_EDIT_PRS"), QIconSet(),
2188 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2189 this, SLOT(OnEditCutPlanes()));
2191 createAction( VISU_EDIT_CUTLINES, tr("MEN_EDIT_PRS"), QIconSet(),
2192 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2193 this, SLOT(OnEditCutLines()));
2195 createAction( VISU_EDIT_ISOSURFACE, tr("MEN_EDIT_PRS"), QIconSet(),
2196 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2197 this, SLOT(OnEditIsoSurfaces()));
2199 createAction( VISU_EDIT_VECTORS, tr("MEN_EDIT_PRS"), QIconSet(),
2200 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2201 this, SLOT(OnEditVectors()));
2203 createAction( VISU_EDIT_STREAMLINES, tr("MEN_EDIT_PRS"), QIconSet(),
2204 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2205 this, SLOT(OnEditStreamLines()));
2207 createAction( VISU_EDIT_PLOT3D, tr("MEN_EDIT_PRS"), QIconSet(),
2208 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2209 this, SLOT(OnEditPlot3D()));
2211 createAction( VISU_EDIT_SCALARMAPONDEFORMEDSHAPE, tr("MEN_EDIT_PRS"), QIconSet(),
2212 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2213 this, SLOT(OnEditScalarMapOnDeformedShape()));
2216 createAction( VISU_CREATE_TABLE, tr("MEN_CREATE_TABLE"), QIconSet(),
2217 tr("MEN_CREATE_TABLE"), "", 0, aParent, false,
2218 this, SLOT(OnCreateTable()));
2220 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SWEEP"));
2221 createAction( VISU_SWEEP, tr("MEN_SWEEP"), QIconSet(aPixmap),
2222 tr("MEN_SWEEP"), "", 0, aParent, false,
2223 this, SLOT(OnSweep()));
2225 createAction( VISU_CLIPPING, tr("MEN_CLIPPING"), QIconSet(),
2226 tr("MEN_CLIPPING"), "", 0, aParent, false,
2227 this, SLOT(OnClippingPlanes()));
2229 createAction( VISU_SELECTION_INFO, tr("MEN_SELECTION_INFO"), QIconSet(),
2230 tr("MEN_SELECTION_INFO"), "", 0, aParent, false,
2231 this, SLOT(OnSelectionInfo()));
2233 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_TIMEANIMATION"));
2234 createAction( VISU_ANIMATION, tr("MEN_ANIMATION"), QIconSet(aPixmap),
2235 tr("MEN_ANIMATION"), "", 0, aParent, false,
2236 this, SLOT(OnTimeAnimation()));
2238 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ERASE_ALL"));
2239 createAction( VISU_ERASE_ALL, tr("MEN_ERASE_ALL"), QIconSet(aPixmap),
2240 tr("MEN_ERASE_ALL"), "", 0, aParent, false,
2241 this, SLOT(OnEraseAll()));
2243 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_GLOBAL_SELECTION"));
2244 createAction( VISU_GLOBAL_SELECTION, tr("MEN_GLOBAL_SELECTION"), QIconSet(aPixmap),
2245 tr("MEN_GLOBAL_SELECTION"), "", 0, aParent, false,
2246 //this, SLOT(OnEraseAll()));
2249 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PARTIAL_SELECTION"));
2250 createAction( VISU_PARTIAL_SELECTION, tr("MEN_PARTIAL_SELECTION"), QIconSet(aPixmap),
2251 tr("MEN_PARTIAL_SELECTION"), "", 0, aParent, false,
2252 //this, SLOT(OnEraseAll()));
2255 createAction( VISU_SHOW_ANIMATION, tr("MEN_SHOW_ANIMATION"), QIconSet(),
2256 tr("MEN_SHOW_ANIMATION"), "", 0, aParent, false,
2257 this, SLOT(OnShowAnimation()));
2264 // Add actions to menus
2266 aMenuId = createMenu( tr( "MEN_DESK_FILE" ), -1 );
2267 createMenu( separator(), aMenuId, -1, 10 );
2268 createMenu( VISU_IMPORT_FROM_FILE, aMenuId, 10 ); // import from file
2269 createMenu( VISU_EXPLORE_MED, aMenuId, 10 ); // explore MED file
2270 createMenu( VISU_IMPORT_TABLE, aMenuId, 10 ); // import table
2272 aMenuId = createMenu( tr( "MEN_VISUALIZATION" ), -1, -1, 30 );
2273 createMenu( VISU_SCALAR_MAP, aMenuId, 10 ); // scalar map
2274 createMenu( VISU_DEFORMED_SHAPE, aMenuId, 10 ); // deformed shape
2275 createMenu( VISU_VECTORS, aMenuId, 10 ); // vectors
2276 createMenu( VISU_ISO_SURFACES, aMenuId, 10 ); // iso surfaces
2277 createMenu( VISU_CUT_PLANES, aMenuId, 10 ); // cut planes
2278 createMenu( VISU_CUT_LINES, aMenuId, 10 ); // cut lines
2279 createMenu( VISU_STREAM_LINES, aMenuId, 10 ); // stream lines
2280 createMenu( VISU_PLOT_3D, aMenuId, 10 ); // Plot3d
2281 createMenu( VISU_SCALAR_MAP_ON_DEFORMED_SHAPE, aMenuId, 10 ); // scalar map on deformed shape
2283 aMenuId = createMenu( tr( "MEN_SELECTION" ), -1, -1, 30 );
2284 createMenu( VISU_SELECTION_INFO, aMenuId, 10 ); // selection info
2286 aMenuId = createMenu( tr( "MEN_REPRESENTATION" ), -1, -1, 30 );
2288 createMenu( tr( "MEN_DISPLAY_SELECTION" ), aMenuId, 10 ); // display selection
2289 createMenu( VISU_POINTS, parentId, 10 ); // points
2290 createMenu( VISU_WIREFRAME, parentId, 10 ); // wireframe
2291 createMenu( VISU_SURFACE, parentId, 10 ); // surface
2292 createMenu( VISU_ERASE_ALL, aMenuId, 10 ); // erase all
2293 createMenu( VISU_GLOBAL_SELECTION, aMenuId, 10 ); // global selection
2294 createMenu( VISU_PARTIAL_SELECTION, aMenuId, 10 ); // partial selection
2301 int aToolId = createTool(tr("TOOL_VISUALISATION"));
2302 createTool( VISU_SCALAR_MAP, aToolId );
2303 createTool( VISU_DEFORMED_SHAPE, aToolId );
2304 createTool( VISU_VECTORS, aToolId );
2305 createTool( VISU_ISO_SURFACES, aToolId );
2306 createTool( VISU_CUT_PLANES, aToolId );
2307 createTool( VISU_CUT_LINES, aToolId );
2308 createTool( VISU_STREAM_LINES, aToolId );
2309 createTool( VISU_PLOT_3D, aToolId );
2310 createTool( VISU_SCALAR_MAP_ON_DEFORMED_SHAPE, aToolId );
2312 aToolId = createTool(tr("TOOL_REPRESENTATION"));
2313 createTool( VISU_POINTS, aToolId );
2314 createTool( VISU_WIREFRAME, aToolId );
2315 createTool( VISU_SURFACE, aToolId );
2316 createTool( VISU_ERASE_ALL, aToolId );
2317 createTool( VISU_GLOBAL_SELECTION, aToolId );
2318 createTool( VISU_PARTIAL_SELECTION, aToolId );
2325 // Prepare popup menus
2326 QtxPopupMgr* mgr = popupMgr();
2328 // VISU root commands
2329 mgr->insert( action( VISU_IMPORT_FROM_FILE ), -1, -1, -1 ); // import MED file
2330 mgr->insert( action( VISU_IMPORT_TABLE ), -1, -1, -1 ); // import tables from file
2331 mgr->insert( action( VISU_PLOT2D ), -1, -1, -1 ); // create Plot2d View
2333 //mgr->insert( action( VISU_IMPORT_MED ), -1, -1, -1 ); // import MED structure from MED module
2336 mgr->insert( action( VISU_SCALAR_MAP ), -1, -1, -1 ); // scalar bar
2337 mgr->insert( action( VISU_ISO_SURFACES ), -1, -1, -1 ); // iso surface
2338 mgr->insert( action( VISU_CUT_PLANES ), -1, -1, -1 ); // cut planes
2339 mgr->insert( action( VISU_CUT_LINES ), -1, -1, -1 ); // cut lines
2340 mgr->insert( action( VISU_DEFORMED_SHAPE ), -1, -1, -1 ); // deformed shape
2341 mgr->insert( action( VISU_VECTORS ), -1, -1, -1 ); // vectors
2342 mgr->insert( action( VISU_STREAM_LINES ), -1, -1, -1 ); // stream lines
2343 mgr->insert( action( VISU_PLOT_3D ), -1, -1, -1 ); // Plot3d
2344 mgr->insert( action( VISU_SCALAR_MAP_ON_DEFORMED_SHAPE ), -1, -1, -1 ); // scalar map on deformed shape
2346 mgr->insert( action( VISU_CREATE_PRS ), -1, -1, -1 ); // create presentation
2347 mgr->insert( action( VISU_CREATE_MANY_PRS ), -1, -1, -1 ); // create presentations
2349 mgr->insert( action( VISU_CREATE_TABLE ), -1, -1, -1 ); // create table
2352 mgr->insert( action( VISU_EDIT_SCALARMAP ), -1, -1, -1 );
2353 mgr->insert( action( VISU_EDIT_DEFORMEDSHAPE ), -1, -1, -1 );
2354 mgr->insert( action( VISU_EDIT_CUTPLANES ), -1, -1, -1 );
2355 mgr->insert( action( VISU_EDIT_CUTLINES ), -1, -1, -1 );
2356 mgr->insert( action( VISU_EDIT_ISOSURFACE ), -1, -1, -1 );
2357 mgr->insert( action( VISU_EDIT_VECTORS ), -1, -1, -1 );
2358 mgr->insert( action( VISU_EDIT_STREAMLINES ), -1, -1, -1 );
2359 mgr->insert( action( VISU_EDIT_PLOT3D ), -1, -1, -1 );
2360 mgr->insert( action( VISU_EDIT_SCALARMAPONDEFORMEDSHAPE ), -1, -1, -1 );
2361 mgr->insert( action( VISU_EDIT_CONTAINER ), -1, -1, -1 );
2364 mgr->insert( action( VISU_RENAME ), -1, -1, -1 );
2367 mgr->insert( action( VISU_COPY_PRS ), -1, -1, -1 );
2370 mgr->insert( action( VISU_CLEAR_CONTAINER ), -1, -1, -1 );
2373 //mgr->insert( action( VISU_SHOW_TABLE ), -1, -1, -1 ); // show table
2374 //mgr->insert( action( VISU_CREATE_CURVES ), -1, -1, -1 ); // create curves
2375 //mgr->insert( action( VISU_EXPORT_TABLE ), -1, -1, -1 ); // export table
2377 mgr->insert( separator(), -1, -1, -1 );
2379 mgr->insert( action( VISU_ERASE ), -1, -1, -1 ); // erase
2380 mgr->insert( action( VISU_DISPLAY ), -1, -1, -1 ); // display
2381 mgr->insert( action( VISU_DISPLAY_ONLY ), -1, -1, -1 ); // display only
2383 // "Representation" submenu
2384 int parentId = mgr->insert( tr( "MEN_REPRESENTATION" ), -1, -1 );
2385 mgr->insert( action( VISU_POINTS ) , parentId, -1, -1 ); // points
2386 mgr->insert( action( VISU_WIREFRAME ) , parentId, -1, -1 ); // wireframe
2387 mgr->insert( action( VISU_SURFACE ) , parentId, -1, -1 ); // surface
2388 mgr->insert( action( VISU_INSIDEFRAME ) , parentId, -1, -1 ); // insideframe
2389 mgr->insert( action( VISU_SURFACEFRAME ), parentId, -1, -1 ); // surfaceframe
2390 mgr->insert( action( VISU_SHRINK ) , parentId, -1, -1 ); // shrink
2391 mgr->insert( action( VISU_UNSHRINK ) , parentId, -1, -1 ); // unshrink
2392 mgr->insert( separator(), parentId, -1, -1 );
2393 mgr->insert( action( VISU_SHADING ) , parentId, -1, -1 ); // shading
2394 mgr->insert( action( VISU_NOSHADING ) , parentId, -1, -1 ); // noshading
2396 // "Properties" submenu
2397 parentId = mgr->insert( tr( "MEN_PROPERTIES" ), -1, -1 );
2398 mgr->insert( action( VISU_CELL_COLOR ), parentId, -1, -1 ); // cell color
2399 mgr->insert( action( VISU_EDGE_COLOR ), parentId, -1, -1 ); // edge color
2400 mgr->insert( action( VISU_COLOR ) , parentId, -1, -1 ); // color
2401 mgr->insert( action( VISU_OPACITY ) , parentId, -1, -1 ); // opacity
2402 mgr->insert( action( VISU_LINE_WIDTH ), parentId, -1, -1 ); // line width
2404 mgr->insert( separator(), -1, -1, -1 );
2406 // Other presentations management
2407 mgr->insert( action( VISU_TRANSLATE_PRS ), -1, -1, -1 );
2408 mgr->insert( action( VISU_CLIPPING ), -1, -1, -1 );
2410 mgr->insert( action( VISU_MERGE_SCALAR_BARS ), -1, -1, -1 );
2411 mgr->insert( action( VISU_FREE_SCALAR_BARS ), -1, -1, -1 );
2413 mgr->insert( action( VISU_SWEEP ), -1, -1, -1 );
2414 mgr->insert( action( VISU_ANIMATION ), -1, -1, -1 );
2416 mgr->insert( separator(), -1, -1, -1 );
2418 // view parameters commands
2419 mgr->insert( action( VISU_SAVE_VIEW_PARAMS ), -1, -1, -1 ); // save view params
2420 mgr->insert( action( VISU_SAVE_VIEW_PARAMS_1 ), -1, -1, -1 ); // save view params
2421 mgr->insert( action( VISU_RESTORE_VIEW_PARAMS ), -1, -1, -1 ); // restore view params
2422 //mgr->insert( action( VISU_DELETE_VIEW_PARAMS ), -1, -1, -1 ); // delete view params
2424 mgr->insert( action( VISU_ARRANGE_ACTORS ), -1, -1, -1 ); // arrange actors
2426 mgr->insert( action( VISU_CURVE_PROPS ), -1, -1, -1 ); // curve properties
2428 mgr->insert( action( VISU_SELECTION_INFO ), -1, -1, -1 ); // Selection info
2432 QString aPrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
2433 "'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE'");
2435 // VISU root commands
2436 QString aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TVISUGEN'";
2437 mgr->setRule( action( VISU_IMPORT_FROM_FILE ), aRule, true );
2438 mgr->setRule( action( VISU_IMPORT_TABLE ), aRule, true );
2439 mgr->setRule( action( VISU_PLOT2D ), aRule, true );
2441 // timestamp commands
2442 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TTIMESTAMP'";
2443 mgr->setRule( action( VISU_SCALAR_MAP ), aRule, true );
2444 mgr->setRule( action( VISU_ISO_SURFACES ), aRule, true );
2445 mgr->setRule( action( VISU_CUT_PLANES ), aRule, true );
2446 mgr->setRule( action( VISU_CUT_LINES ), aRule, true );
2447 mgr->setRule( action( VISU_PLOT_3D ), aRule, true );
2448 aRule += " and nbComponents>1";
2449 mgr->setRule( action( VISU_DEFORMED_SHAPE ), aRule, true );
2450 mgr->setRule( action( VISU_VECTORS ), aRule, true );
2451 mgr->setRule( action( VISU_STREAM_LINES ), aRule, true );
2452 mgr->setRule( action( VISU_SCALAR_MAP_ON_DEFORMED_SHAPE ), aRule, true );
2454 // display/erase commands
2455 QString andInvisible = " and (((not isVisible) and isActiveView) or (not isActiveView))";
2456 QString aTableOrCont = "(type='VISU::TTABLE' and nbChildren>0) or type='VISU::TCONTAINER'";
2457 QString orCurveVisible = "or (type='VISU::TCURVE' and isVisible)";
2458 QString orCurveInvisible = "or (type='VISU::TCURVE'" + andInvisible + ")";
2459 QString aPrsVisible = "(($type in {'VISU::TMESH' " + aPrsAll + "}) and isVisible)";
2460 QString aPrsInvisible = "(($type in {'VISU::TMESH' " + aPrsAll + "})" + andInvisible + ")";
2461 QString aComponent = "( selcount=1 and canBeDisplayed and isComponent )";
2463 QString anEraseRule = "( selcount>0 and ({true} in $canBeDisplayed) and (" + aPrsVisible +
2464 " or (client='ObjectBrowser' and (" + aTableOrCont + orCurveVisible + "))) ) or " + aComponent;
2466 QString aDisplayRule = "( selcount>0 and ({true} in $canBeDisplayed) and (" + aPrsInvisible +
2467 " or (client='ObjectBrowser' and (" + aTableOrCont + orCurveInvisible + "))) ) or" + aComponent;
2469 QString aDOnlyRule = "( selcount>0 and ({true} in $canBeDisplayed) and (($type in {'VISU::TMESH' " + aPrsAll + "})"
2470 " or (client='ObjectBrowser' and ((type='VISU::TTABLE' and nbChildren>0) or"
2471 " ($type in {'VISU::TCURVE' 'VISU::TCONTAINER'})))) ) or" + aComponent;
2473 mgr->setRule( action( VISU_ERASE ), anEraseRule, true );
2474 mgr->setRule( action( VISU_DISPLAY ), aDisplayRule, true );
2475 mgr->setRule( action( VISU_DISPLAY_ONLY ), aDOnlyRule, true );
2477 aRule = "selcount>0 and $type in {'VISU::TMESH' " + aPrsAll + "}";
2478 mgr->setRule( action( VISU_TRANSLATE_PRS ), aRule, true );
2480 aRule = "selcount>1 and $type in {'VISU::TMESH' " + aPrsAll + "}";
2481 mgr->setRule( action( VISU_MERGE_SCALAR_BARS ), aRule, true );
2482 mgr->setRule( action( VISU_FREE_SCALAR_BARS ), aRule, true );
2485 aRule = "selcount=1 and type='VISU::TVIEW3D' and activeView='VTKViewer'";
2486 mgr->setRule( action( VISU_SAVE_VIEW_PARAMS_1 ), aRule, true );
2487 mgr->setRule( action( VISU_SAVE_VIEW_PARAMS ), "client='VTKViewer' and selcount=0 and activeView='VTKViewer'", true );
2488 mgr->setRule( action( VISU_RESTORE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D' and activeView='VTKViewer'", true );
2489 //mgr->setRule( action( VISU_DELETE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D'", true );
2491 mgr->setRule( action( VISU_ARRANGE_ACTORS ), "client='VTKViewer' and selcount=0", true );
2493 // 3D presentations commands
2494 QString aPrsType = " and $type in {'VISU::TMESH' " + aPrsAll + "}";
2495 QString aInsideType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE'}";
2496 QString aSurfType = " and $type in {'VISU::TMESH'}";
2497 QString aShrinkType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' "
2498 "'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE'}";
2499 QString aLineType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
2500 "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' }";
2502 aRule = "selcount=1";
2503 mgr->setRule( action( VISU_CLIPPING ), aRule + aPrsType, true );
2505 // "Representation" submenu
2506 QString aNotPoints = " and $representation in {'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}";
2507 QString aNotWirefr = " and $representation in {'VISU::POINT' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}";
2508 QString aNotSurfac = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}";
2509 QString aNotInside = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::SURFACEFRAME'}";
2510 QString aNotSurffr = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}";
2512 mgr->setRule( action( VISU_POINTS ) , aRule + aPrsType + aNotPoints, true );
2513 mgr->setRule( action( VISU_WIREFRAME ) , aRule + aPrsType + aNotWirefr, true );
2514 mgr->setRule( action( VISU_SURFACE ) , aRule + aPrsType + aNotSurfac, true );
2515 mgr->setRule( action( VISU_INSIDEFRAME ) , aRule + aInsideType + aNotInside, true );
2516 mgr->setRule( action( VISU_SURFACEFRAME ), aRule + aSurfType + aNotSurffr, true );
2518 mgr->setRule( action( VISU_SHRINK ) , aRule + aShrinkType + " and isShrunk=0", true );
2519 mgr->setRule( action( VISU_UNSHRINK ), aRule + aShrinkType + " and isShrunk=1", true );
2521 mgr->setRule( action( VISU_SHADING ) , aRule + " and isScalarMapAct=1 and isShading=0", true );
2522 mgr->setRule( action( VISU_NOSHADING ), aRule + " and isScalarMapAct=1 and isShading=1", true );
2524 // "Properties" submenu
2525 mgr->setRule( action( VISU_CELL_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'", true );
2526 mgr->setRule( action( VISU_EDGE_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'", true );
2527 mgr->setRule( action( VISU_COLOR ), aRule + " and ((type='VISU::TMESH'"
2528 " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}) "
2529 "or (type='VISU::TDEFORMEDSHAPE' and hasActor=1))", true );
2530 mgr->setRule( action( VISU_OPACITY ), aRule + aShrinkType + " and hasActor=1", true );
2531 mgr->setRule( action( VISU_LINE_WIDTH ), aRule + aLineType + " and hasActor=1", true );
2534 QString aCurveAll = "'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER'";
2536 aRule = "selcount=1 and ($type in {'VISU::TVIEW3D' 'VISU::TMESH' " + aCurveAll + " " + aPrsAll + "})";
2537 mgr->setRule( action( VISU_RENAME ), aRule, true );
2539 // copy presentation command
2540 aRule = "selcount=1 and ($type in {" + aPrsAll + "})";
2541 mgr->setRule( action( VISU_COPY_PRS ), aRule, true );
2544 aRule = "selcount=1 and type='VISU::TCURVE'";
2545 mgr->setRule( action( VISU_CURVE_PROPS ), aRule, true );
2547 // curve container commands
2548 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TCONTAINER'";
2549 mgr->setRule( action( VISU_EDIT_CONTAINER ), aRule, true );
2550 mgr->setRule( action( VISU_CLEAR_CONTAINER ), aRule, true );
2552 mgr->setRule( action( VISU_EDIT_SCALARMAP ),
2553 "selcount=1 and type='VISU::TSCALARMAP'", true );
2554 mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPE ),
2555 "selcount=1 and type='VISU::TDEFORMEDSHAPE'", true );
2556 mgr->setRule( action( VISU_EDIT_SCALARMAPONDEFORMEDSHAPE ),
2557 "selcount=1 and type='VISU::TSCALARMAPONDEFORMEDSHAPE'", true );
2558 mgr->setRule( action( VISU_EDIT_CUTPLANES ),
2559 "selcount=1 and type='VISU::TCUTPLANES'", true );
2560 mgr->setRule( action( VISU_EDIT_CUTLINES ),
2561 "selcount=1 and type='VISU::TCUTLINES'", true );
2562 mgr->setRule( action( VISU_EDIT_ISOSURFACE ),
2563 "selcount=1 and type='VISU::TISOSURFACE'", true );
2564 mgr->setRule( action( VISU_EDIT_VECTORS ),
2565 "selcount=1 and type='VISU::TVECTORS'", true );
2566 mgr->setRule( action( VISU_EDIT_STREAMLINES ),
2567 "selcount=1 and type='VISU::TSTREAMLINES'", true );
2568 mgr->setRule( action( VISU_EDIT_PLOT3D ),
2569 "selcount=1 and type='VISU::TPLOT3D'", true );
2571 aRule = "selcount=1 and type='VISU::TCUTLINES' and nbNamedChildren=0";
2572 mgr->setRule( action( VISU_CREATE_TABLE ), aRule, true );
2574 aRule = "selcount=1 and ($type in {" + aPrsAll + "})";
2575 mgr->setRule( action( VISU_SWEEP ), aRule, true );
2577 // "Selection info" popup item
2578 aRule = "client='VTKViewer' and selcount=1" + aInsideType;
2579 mgr->setRule( action( VISU_SELECTION_INFO ), aRule, true );
2581 aRule = "client='ObjectBrowser' and selcount>0";
2582 aRule += " and $type in {'VISU::TFIELD'}";
2583 aRule += " and nbTimeStamps>1";
2584 aRule += " and activeView in {'VTKViewer' 'VVTK'}";
2585 mgr->setRule( action( VISU_ANIMATION ), aRule, true );
2587 aRule = "client='ObjectBrowser' and $type in {'VISU::TENTITY' 'VISU::TFAMILY' 'VISU::TGROUP'}";
2588 mgr->setRule( action( VISU_CREATE_PRS ), aRule + " and selcount=1", true );
2589 mgr->setRule( action( VISU_CREATE_MANY_PRS ), aRule + " and selcount>1", true );
2591 //aRule = "client='ObjectBrowser' and type='MEDFIELD'";
2592 //mgr->setRule( action( VISU_IMPORT_MED ), aRule, true );
2595 //***************************************************************************
2596 void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, QString& theTitle )
2598 SalomeApp_Module::contextMenuPopup(theClient, theMenu, theTitle);
2600 OB_Browser* ob = getApp()->objectBrowser();
2601 bool isOBClient = (ob && theClient == ob->popupClientType());
2603 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2604 SALOME_ListIO aListIO;
2605 aSelectionMgr->selectedObjects(aListIO);
2607 if (aListIO.Extent() < 1) return;
2609 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2611 // Check if "Merge Scalar Range" can be applied
2613 SALOME_ListIteratorOfListIO It (aListIO);
2614 for (; It.More(); It.Next()) {
2615 Handle(SALOME_InteractiveObject)& anIO = It.Value();
2617 if (!anIO.IsNull() && anIO->hasEntry()) {
2618 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
2619 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSObject);
2620 if (CORBA::is_nil(aCORBAObject)) {
2621 _PTR(GenericAttribute) anAttr;
2622 if (aSObject->FindAttribute(anAttr, "AttributeComment")) {
2623 _PTR(AttributeComment) aComment (anAttr);
2624 string aComm = aComment->Value();
2625 QString strIn (aComm.c_str());
2626 VISU::Storable::TRestoringMap pMap;
2627 VISU::Storable::StrToMap(strIn, pMap);
2629 VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(pMap,"myType",&isExist).toInt();
2630 if (isExist && aType == VISU::TTIMESTAMP) {
2631 _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(aSObject);
2633 for (; anIter->More(); anIter->Next()) {
2634 aPrs = anIter->Value();
2635 if (!aPrs) continue;
2636 std::vector<VISU::Prs3d_i*> aSubList = GetPrs3dList(this, aPrs);
2637 nbPrs += aSubList.size();
2646 theMenu->insertSeparator();
2647 action( VISU_MERGE_SCALAR_BARS )->addTo(theMenu);
2648 action( VISU_FREE_SCALAR_BARS )->addTo(theMenu);
2651 theMenu->insertSeparator();
2653 // Check if some (nb > 0) removable objects selected
2654 if (isOBClient && IsRemovableSelected(this)) {
2655 action( VISU_DELETE_OBJS )->addTo(theMenu);
2658 // Check if some curves selected (for bug PAL10611)
2659 bool isCurves = false;
2660 SALOME_ListIteratorOfListIO It1 (aListIO);
2661 for (; It1.More() && !isCurves; It1.Next()) {
2662 Handle(SALOME_InteractiveObject)& anIO = It1.Value();
2664 if (!anIO.IsNull() && anIO->hasEntry()) {
2665 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
2666 _PTR(GenericAttribute) anAttr;
2667 if (aSObject->FindAttribute(anAttr, "AttributeComment")) {
2668 _PTR(AttributeComment) aComment (anAttr);
2669 string aComm = aComment->Value();
2670 QString strIn (aComm.c_str());
2671 VISU::Storable::TRestoringMap pMap;
2672 VISU::Storable::StrToMap(strIn, pMap);
2674 VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(pMap,"myType",&isExist).toInt();
2675 if (isExist && aType == VISU::TCURVE) {
2682 action( myDisplay )->removeFrom(theMenu);
2683 action( myErase )->removeFrom(theMenu);
2684 action( myDisplayOnly )->removeFrom(theMenu);
2685 action( myEraseAll )->removeFrom(theMenu);
2688 // Check single selection
2689 if (aListIO.Extent() != 1) return;
2691 Handle(SALOME_InteractiveObject) anIO;
2692 VISU::Storable::TRestoringMap aMap;
2693 CORBA::Object_var anObject = GetSelectedObj( this, &anIO, &aMap);
2695 _PTR(SObject) SO = aCStudy->FindObjectID(anIO->getEntry());
2697 VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
2699 if (aType == VISU::TANIMATION) {
2700 action( VISU_SHOW_ANIMATION )->addTo(theMenu);
2702 } else if (isOBClient) {
2703 if (IsSObjectTable(SO)) {
2704 action( VISU_SHOW_TABLE )->addTo(theMenu);
2705 action( VISU_CREATE_CURVES )->addTo(theMenu);
2706 action( VISU_EXPORT_TABLE )->addTo(theMenu);
2707 theMenu->insertSeparator();
2709 if (!CORBA::is_nil(anObject)) {
2710 SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
2711 if (!CORBA::is_nil(aMED.in())) {
2712 action( VISU_IMPORT_MED_STRUCTURE )->addTo(theMenu);
2715 SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject); // "Import Structure"
2716 if (!CORBA::is_nil(aField)) {
2717 action( VISU_IMPORT_MED_TIMESTAMP )->addTo(theMenu); // "Import TimeStamp"
2720 _PTR(SObject) aSFather = SO->GetFather();
2722 _PTR(GenericAttribute) anAttr;
2723 aSFather->FindAttribute(anAttr, "AttributeName");
2725 _PTR(AttributeName) aName (anAttr);
2726 std::string aValue = aName->Value();
2727 if (strcmp(aValue.c_str(), "MEDFIELD") == 0) {
2728 action( VISU_IMPORT_MED_FIELD )->addTo(theMenu); // "Import Field"
2738 //***************************************************************************
2741 windows( QMap<int, int>& theMap ) const
2744 theMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::DockLeft );
2745 theMap.insert( SalomeApp_Application::WT_PyConsole, Qt::DockBottom );
2751 viewManagers( QStringList& theList ) const
2754 theList.append( SVTK_Viewer::Type() );
2762 CORBA::String_var anIOR = GetVisuGen(this)->GetID();
2763 return QString(anIOR.in());
2769 activateModule( SUIT_Study* theStudy )
2771 SalomeApp_Module::activateModule( theStudy );
2773 setMenuShown( true );
2774 setToolShown( true );
2781 deactivateModule( SUIT_Study* theStudy )
2783 setMenuShown( false );
2784 setToolShown( false );
2786 SalomeApp_Module::deactivateModule( theStudy );
2792 createSelection() const
2794 return new VisuGUI_Selection( (SalomeApp_Module*)this );
2797 //******************************************************************
2798 void VisuGUI::studyActivated()
2800 GetVisuGen(this)->SetCurrentStudy(GetDSStudy(GetCStudy(GetAppStudy(this))));
2808 return new VisuGUI();
2813 void VisuGUI::createPreferences()
2815 // TAB: "Scalar Bar"
2816 int sbarTab = addPreference( tr( "VISU_SCALAR_BAR" ) );
2818 int rangeGr = addPreference( tr( "VISU_SCALAR_RANGE" ), sbarTab );
2819 setPreferenceProperty( rangeGr, "columns", 1 );
2821 int mode = addPreference( tr( "VISU_SCALAR_MODE" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_bar_mode" );
2823 modes.append( tr( "VISU_MODULUS" ) );
2824 modes.append( tr( "VISU_COMPONENT" ) + tr("1") );
2825 modes.append( tr( "VISU_COMPONENT" ) + tr("2") );
2826 modes.append( tr( "VISU_COMPONENT" ) + tr("3") );
2827 QValueList<QVariant> indices;
2828 indices.append( 0 );
2829 indices.append( 1 );
2830 indices.append( 2 );
2831 indices.append( 3 );
2832 setPreferenceProperty( mode, "strings", modes );
2833 setPreferenceProperty( mode, "indexes", indices );
2835 addPreference( tr( "VISU_LOGARITHMIC_SCALING" ), rangeGr, LightApp_Preferences::Bool, "VISU", "scalar_bar_logarithmic" );
2837 int rangetype = addPreference( tr( "VISU_RANGE_TO_USE" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_range_type" );
2839 types.append( tr( "VISU_FIELD_RANGE" ) );
2840 types.append( tr( "VISU_IMPOSED_RANGE" ) );
2842 indices.append( 0 );
2843 indices.append( 1 );
2844 setPreferenceProperty( rangetype, "strings", types );
2845 setPreferenceProperty( rangetype, "indexes", indices );
2847 int imposedGr = addPreference( tr( "VISU_MINMAX_IMPOSED_RANGE" ), sbarTab );
2849 int min = addPreference( tr( "VISU_MIN" ), imposedGr, LightApp_Preferences::DblSpin, "VISU", "scalar_range_min" );
2850 int max = addPreference( tr( "VISU_MAX" ), imposedGr, LightApp_Preferences::DblSpin, "VISU", "scalar_range_max" );
2851 setPreferenceProperty( min, "step", 0.1 );
2852 setPreferenceProperty( max, "step", 0.1 );
2855 int fontGr = addPreference( tr( "VISU_FONT" ), sbarTab );
2856 int tfont = addPreference( tr( "VISU_TITLE" ), fontGr,
2857 LightApp_Preferences::Font, "VISU", "scalar_bar_title_font" );
2858 addPreference( tr( "VISU_TITLE" ), fontGr,
2859 LightApp_Preferences::Color, "VISU", "scalar_bar_title_color" );
2860 int lfont = addPreference( tr( "VISU_LABELS" ), fontGr,
2861 LightApp_Preferences::Font, "VISU", "scalar_bar_label_font" );
2862 addPreference( tr( "VISU_LABELS" ), fontGr,
2863 LightApp_Preferences::Color, "VISU", "scalar_bar_label_color" );
2866 fam.append( tr( "VISU_FONT_ARIAL" ) );
2867 fam.append( tr( "VISU_FONT_COURIER" ) );
2868 fam.append( tr( "VISU_FONT_TIMES" ) );
2869 int wflag = ( QtxListResourceEdit::FontItem::All &
2870 ( ~( QtxListResourceEdit::FontItem::Size |
2871 QtxListResourceEdit::FontItem::UserSize ) ) );
2873 setPreferenceProperty( tfont, "families", fam );
2874 setPreferenceProperty( tfont, "system", false );
2875 setPreferenceProperty( tfont, "widget_flags", wflag );
2876 setPreferenceProperty( lfont, "families", fam );
2877 setPreferenceProperty( lfont, "system", false );
2878 setPreferenceProperty( lfont, "widget_flags", wflag );
2880 // group: "Colors & Labels"
2881 int colorsLabelsGr = addPreference( tr( "VISU_COLORS_AND_LABELS" ), sbarTab );
2883 int numcol = addPreference( tr( "VISU_NB_COLORS" ), colorsLabelsGr,
2884 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_num_colors" );
2885 setPreferenceProperty( numcol, "min", 2 );
2886 setPreferenceProperty( numcol, "max", 256 );
2888 int numlab = addPreference( tr( "VISU_NB_LABELS" ), colorsLabelsGr,
2889 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_num_labels" );
2890 setPreferenceProperty( numlab, "min", 2 );
2891 setPreferenceProperty( numlab, "max", 65 );
2893 // group: "Orientation"
2894 int orientGr = addPreference( tr( "VISU_ORIENTATION" ), sbarTab );
2895 int orient = addPreference( tr( "VISU_ORIENTATION" ), orientGr,
2896 LightApp_Preferences::Selector, "VISU", "scalar_bar_orientation" );
2897 QStringList orients;
2898 orients.append( tr( "VISU_VERTICAL" ) );
2899 orients.append( tr( "VISU_HORIZONTAL" ) );
2901 indices.append( 0 );
2902 indices.append( 1 );
2903 setPreferenceProperty( orient, "strings", orients );
2904 setPreferenceProperty( orient, "indexes", indices );
2906 // group: "Origin & Size Vertical"
2907 int posVSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_VERTICAL" ), sbarTab );
2908 int xv = addPreference( tr( "VISU_X" ), posVSizeGr,
2909 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_x" );
2910 int yv = addPreference( tr( "VISU_Y" ), posVSizeGr,
2911 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_y" );
2912 int wv = addPreference( tr( "VISU_WIDTH" ), posVSizeGr,
2913 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_width" );
2914 int hv = addPreference( tr( "VISU_HEIGHT" ), posVSizeGr,
2915 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_height" );
2916 setPreferenceProperty( xv, "step", 0.1 );
2917 setPreferenceProperty( yv, "step", 0.1 );
2918 setPreferenceProperty( wv, "step", 0.1 );
2919 setPreferenceProperty( hv, "step", 0.1 );
2920 setPreferenceProperty( xv, "min", 0.0 );
2921 setPreferenceProperty( yv, "min", 0.0 );
2922 setPreferenceProperty( wv, "min", 0.0 );
2923 setPreferenceProperty( hv, "min", 0.0 );
2924 setPreferenceProperty( xv, "max", 1.0 );
2925 setPreferenceProperty( yv, "max", 1.0 );
2926 setPreferenceProperty( wv, "max", 1.0 );
2927 setPreferenceProperty( hv, "max", 1.0 );
2929 // group: "Origin & Size Horizontal"
2930 int posHSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_HORIZONTAL" ), sbarTab );
2931 int xh = addPreference( tr( "VISU_X" ), posHSizeGr,
2932 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_x" );
2933 int yh = addPreference( tr( "VISU_Y" ), posHSizeGr,
2934 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_y" );
2935 int wh = addPreference( tr( "VISU_WIDTH" ), posHSizeGr,
2936 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_width" );
2937 int hh = addPreference( tr( "VISU_HEIGHT" ), posHSizeGr,
2938 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_height" );
2939 setPreferenceProperty( xh, "step", 0.1 );
2940 setPreferenceProperty( yh, "step", 0.1 );
2941 setPreferenceProperty( wh, "step", 0.1 );
2942 setPreferenceProperty( hh, "step", 0.1 );
2943 setPreferenceProperty( xh, "min", 0.0 );
2944 setPreferenceProperty( yh, "min", 0.0 );
2945 setPreferenceProperty( wh, "min", 0.0 );
2946 setPreferenceProperty( hh, "min", 0.0 );
2947 setPreferenceProperty( xh, "max", 1.0 );
2948 setPreferenceProperty( yh, "max", 1.0 );
2949 setPreferenceProperty( wh, "max", 1.0 );
2950 setPreferenceProperty( hh, "max", 1.0 );
2952 // group: "Scalar bars default position"
2953 int scalarBarGr = addPreference( tr( "Scalar bars default position" ), sbarTab );
2954 addPreference( tr( "Arrange Scalar Bars" ), scalarBarGr, LightApp_Preferences::Bool, "VISU", "scalar_bars_default_position" );
2956 int srangeTab = addPreference( tr( "Sweep, MED import" ) );
2958 // group: "Sweeping preferences"
2959 int sweepGr = addPreference( tr( "VISU_SWEEPING_PREF" ), srangeTab );
2960 setPreferenceProperty( sweepGr, "columns", 1 );
2962 int timestep = addPreference( tr( "VISU_TIME_STEP" ), sweepGr,
2963 LightApp_Preferences::DblSpin, "VISU", "sweeping_time_step" );
2964 int nbcycles = addPreference( tr( "VISU_NB_CYCLES" ), sweepGr,
2965 LightApp_Preferences::IntSpin, "VISU", "sweeping_number_cycles" );
2966 int nbsteps = addPreference( tr( "VISU_NB_STEPS" ), sweepGr,
2967 LightApp_Preferences::IntSpin, "VISU", "sweeping_number_steps" );
2968 setPreferenceProperty( timestep, "min", 0.1 );
2969 setPreferenceProperty( timestep, "step", 0.1 );
2970 setPreferenceProperty( timestep, "max", 1000 );
2971 setPreferenceProperty( nbcycles, "max", 100 );
2972 setPreferenceProperty( nbsteps, "max", 200 );
2974 // group: "MED files import"
2975 int importGr = addPreference( tr( "MED files import" ), srangeTab );
2976 setPreferenceProperty( importGr, "columns", 1 );
2977 addPreference( tr( "Full MED loading" ), importGr, LightApp_Preferences::Bool, "VISU", "full_med_loading" );
2978 addPreference( tr( "Build at once" ), importGr, LightApp_Preferences::Bool, "VISU", "build_at_once" );
2979 addPreference( tr( "Build fields" ), importGr, LightApp_Preferences::Bool, "VISU", "build_fields" );
2980 addPreference( tr( "Build min/max" ), importGr, LightApp_Preferences::Bool, "VISU", "build_min_max" );
2981 addPreference( tr( "Build groups" ), importGr, LightApp_Preferences::Bool, "VISU", "build_groups" );
2982 addPreference( tr( "Close dialog at finish" ), importGr, LightApp_Preferences::Bool, "VISU", "close_at_finish" );
2984 // group: "Representation properties"
2985 int representGr = addPreference( tr( "VISU_PREF_REPRESENT_PROPS" ), srangeTab );
2986 addPreference( tr( "VISU_PREF_SHADING" ), representGr,
2987 LightApp_Preferences::Bool, "VISU", "represent_shading" );
2990 void VisuGUI::preferencesChanged( const QString& a, const QString& b)
2992 if (a != QString("VISU")) return;
2993 if (b == QString("scalar_bar_orientation")) return;
2994 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
2995 float sbX1,sbY1,sbW,sbH;
2996 std::string aWarning;
2997 if(b == QString("scalar_bar_vertical_x") || b == QString("scalar_bar_vertical_width")){
2998 sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_x", sbX1);
2999 sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_width", sbW);
3001 aWarning = "Origin and Size Vertical: X+Width > 1\n";
3004 aResourceMgr->setValue("VISU", "scalar_bar_vertical_x", sbX1);
3005 aResourceMgr->setValue("VISU", "scalar_bar_vertical_width", sbW);
3008 else if(b == QString("scalar_bar_vertical_y") || b == QString("scalar_bar_vertical_height")){
3009 sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_y", sbY1);
3010 sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_height",sbH);
3012 aWarning = "Origin and Size Vertical: Y+Height > 1\n";
3015 aResourceMgr->setValue("VISU", "scalar_bar_vertical_y", sbY1);
3016 aResourceMgr->setValue("VISU", "scalar_bar_vertical_height",sbH);
3019 else if(b == QString("scalar_bar_horizontal_x") || b == QString("scalar_bar_horizontal_width")){
3020 sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_x", sbX1);
3021 sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_width", sbW);
3023 aWarning = "Origin and Size Horizontal: X+Width > 1\n";
3026 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_x", sbX1);
3027 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_width", sbW);
3030 else if(b == QString("scalar_bar_horizontal_y") || b == QString("scalar_bar_horizontal_height")){
3031 sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_y", sbY1);
3032 sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_height",sbH);
3034 aWarning = "Origin and Size Horizontal: Y+Height > 1\n";
3037 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_y", sbY1);
3038 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_height",sbH);
3041 if (aWarning.size() != 0){
3042 aWarning += "The default values are applied instead.";
3043 SUIT_MessageBox::warn1(GetDesktop(this),
3044 tr("ERR_SCALARBAR_PARAMS"),
3045 tr(aWarning.c_str()),
3052 ::getViewManager(const QString& theType,
3053 const bool theIsCreate)
3055 return getApp()->getViewManager(theType,theIsCreate);
3060 ::getScalarBarsMap()
3062 return myScalarBarsMap;
3064 LightApp_Displayer* VisuGUI::displayer()
3067 myDisplayer = new VisuGUI_Displayer( getApp() );