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
25 // Author : Laurent CORNABE
38 #include <qptrvector.h>
39 #include <qcolordialog.h>
42 #include <vtkRenderer.h>
43 #include <vtkRenderWindow.h>
44 #include <vtkActorCollection.h>
47 #include "SALOME_LifeCycleCORBA.hxx"
49 #include "SUIT_ResourceMgr.h"
50 #include "SUIT_MessageBox.h"
52 #include "SUIT_ViewWindow.h"
53 #include "SUIT_ViewManager.h"
55 #include "CAM_Module.h"
57 #include "SVTK_RenderWindow.h"
58 #include "SVTK_ViewWindow.h"
59 #include "SVTK_ViewModel.h"
60 #include "SVTK_Functor.h"
62 #include "SPlot2d_ViewModel.h"
63 #include "VisuGUI_SetupPlot2dDlg.h"
64 #include "Plot2d_SetupCurveDlg.h"
65 #include "Plot2d_ViewManager.h"
67 #include "OB_Browser.h"
69 #include "SALOME_ListIO.hxx"
70 #include "SALOME_ListIteratorOfListIO.hxx"
72 #include "SalomeApp_Application.h"
73 #include "SalomeApp_DataModel.h"
74 #include "SalomeApp_Study.h"
75 #include "LightApp_SelectionMgr.h"
76 #include "LightApp_Selection.h"
77 #include "LightApp_Preferences.h"
79 #include "QtxAction.h"
81 #include "VISUConfig.hh"
82 #include "VISU_Gen_i.hh"
83 #include "VISU_Mesh_i.hh"
84 #include "VISU_Table_i.hh"
85 #include "VISU_Result_i.hh"
86 #include "VISU_View_i.hh"
87 #include "VISU_ViewManager_i.hh"
88 #include "VISU_Plot3D_i.hh"
90 #include "VISU_Actor.h"
92 #include "VisuGUI_Prs3dTools.h"
93 #include "VisuGUI_Tools.h"
95 #include "VisuGUI_PopupTools.h"
96 #include "VisuGUI_NameDlg.h"
97 #include "VisuGUI_FileDlg.h"
98 #include "VisuGUI_CursorDlg.h"
99 #include "VisuGUI_Selection.h"
100 #include "VisuGUI_TimeAnimation.h"
101 #include "VisuGUI_EditContainerDlg.h"
102 #include "VisuGUI_NonIsometricDlg.h"
103 #include "VisuGUI_ClippingDlg.h"
104 #include "VisuGUI_Plot3DDlg.h"
105 #include "VisuGUI_CubeAxesDlg.h"
106 #include "VisuGUI_OffsetDlg.h"
107 #include "VisuGUI_Displayer.h"
109 #include "VISU_ScalarMap_i.hh"
110 #include "VisuGUI_ScalarBarDlg.h"
112 #include "VISU_DeformedShape_i.hh"
113 #include "VisuGUI_DeformedShapeDlg.h"
115 #include "VISU_IsoSurfaces_i.hh"
116 #include "VisuGUI_IsoSurfacesDlg.h"
118 #include "VISU_CutPlanes_i.hh"
119 #include "VisuGUI_CutPlanesDlg.h"
121 #include "VISU_CutLines_i.hh"
122 #include "VisuGUI_CutLinesDlg.h"
124 #include "VISU_StreamLines_i.hh"
125 #include "VisuGUI_StreamLinesDlg.h"
127 #include "VISU_Vectors_i.hh"
128 #include "VisuGUI_VectorsDlg.h"
130 #include "VisuGUI_TableDlg.h"
132 #include "SALOMEconfig.h"
133 #include CORBA_SERVER_HEADER(MED_Gen)
135 #include "utilities.h"
137 #include "VisuGUI_ActionsDef.h"
139 using namespace VISU;
142 static int MYDEBUG = 1;
144 static int MYDEBUG = 0;
147 //////////////////////////////////////////////////
149 //////////////////////////////////////////////////
152 SalomeApp_Module( "VISU" ),
167 if(MYDEBUG) MESSAGE("VisuGUI::OnImportFromFile()");
168 if ( CheckLock(GetCStudy(GetAppStudy(this))) )
170 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
173 aFilter.append( tr("FLT_MED_FILES") );
174 aFilter.append( tr("FLT_ALL_FILES") );
176 QFileInfo aFileInfo =
177 SUIT_FileDlg::getFileName(GetDesktop(this),
180 tr("MEN_IMPORT_FROM_FILE"),
182 if(aFileInfo.exists()) {
183 application()->putInfo( "Importing From File " + aFileInfo.filePath() + "..." );
185 VISU::Result_var aResult;
186 bool anIsBuild = aResourceMgr->booleanValue("VISU", "full_med_loading", false);
187 if (VisuGUI_FileDlg::IsBuild) {
188 aResult = GetVisuGen(this)->ImportFile(aFileInfo.filePath());
189 if (!CORBA::is_nil(aResult.in()))
190 if (Result_i* aRes = dynamic_cast<Result_i*>(GetServant(aResult).in())) {
191 if (!aRes->IsPossible())
192 SUIT_MessageBox::warn1(GetDesktop(this),
194 tr("ERR_CANT_BUILD_PRESENTATION"),
200 aResourceMgr->setValue("VISU", "full_med_loading", false);
201 aResult = GetVisuGen(this)->ImportFile(aFileInfo.filePath());
202 aResourceMgr->setValue("VISU", "full_med_loading", anIsBuild);
205 if (CORBA::is_nil(aResult.in())) {
206 SUIT_MessageBox::warn1(GetDesktop(this),
208 tr("ERR_ERROR_IN_THE_FILE"),
211 application()->putInfo(aFileInfo.filePath() + tr("INF_DONE"));
212 UpdateObjBrowser(this);
222 if(MYDEBUG) MESSAGE("VisuGUI::OnExploreMEDFile()");
223 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
224 if ( CheckLock(aStudy) )
227 SALOME_MED::MED_Gen_var aGen = GetMEDEngine();
230 aFilter.append( tr("FLT_MED_FILES") );
231 aFilter.append( tr("FLT_ALL_FILES") );
233 QFileInfo aFileInfo =
234 SUIT_FileDlg::getFileName(GetDesktop(this),
237 tr("MEN_EXPLORE_MED_FILE"),
239 if(aFileInfo.exists()){
240 application()->putInfo( tr("MEN_EXPLORE_MED_FILE") + " " + aFileInfo.filePath() + "..." );
241 std::string aStudyName = aStudy->Name();
244 aGen->readStructFileWithFieldType(aFileInfo.filePath(),aStudyName.c_str());
248 SUIT_MessageBox::warn1(GetDesktop(this),
250 tr("ERR_ERROR_IN_THE_FILE"),
253 application()->putInfo(aFileInfo.filePath()+tr("INF_DONE"));
254 getApp()->updateObjectBrowser(true); // as need to update MED tree
255 getApp()->updateActions();
262 OnImportTableFromFile()
264 if(MYDEBUG) MESSAGE("VisuGUI::OnImportTableFromFile()");
265 if ( CheckLock(GetCStudy(GetAppStudy(this))) )
269 aFilter.append( tr("FLT_TABLE_FILES") );
270 aFilter.append( tr("FLT_ALL_FILES") );
272 QFileInfo aFileInfo =
273 SUIT_FileDlg::getFileName(GetDesktop(this),
276 tr("MEN_IMPORT_TABLE"),
278 if (aFileInfo.exists()) {
279 application()->putInfo( tr("MEN_IMPORT_TABLE") + " " + aFileInfo.filePath() + " ..." );
281 CORBA::Object_var anObject = GetVisuGen(this)->ImportTables(aFileInfo.filePath());
283 if (CORBA::is_nil(anObject.in())) {
284 SUIT_MessageBox::warn1(GetDesktop(this),
286 tr("ERR_ERROR_IN_THE_FILE"),
289 application()->putInfo(aFileInfo.filePath()+tr("INF_DONE"));
290 UpdateObjBrowser(this);
297 OnExportTableToFile()
299 if(MYDEBUG) MESSAGE("VisuGUI::OnExportTableToFile()");
301 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
303 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
304 SALOME_ListIO aListIO;
305 aSelectionMgr->selectedObjects(aListIO);
307 if (aListIO.Extent() > 0) {
308 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
309 if (anIO->hasEntry()) {
310 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
313 // find table attribute
315 _PTR(GenericAttribute) anAttr;
317 if (!aSObj->FindAttribute(anAttr, "AttributeTableOfReal")) {
319 if (!aSObj->FindAttribute(anAttr, "AttributeTableOfInteger")) {
320 // if the current SObject is a table title
321 // we take a father contaning the table
322 aSObj = aSObj->GetFather();
324 if (aSObj->FindAttribute(anAttr, "AttributeTableOfReal")) {
327 if (!aSObj->FindAttribute(anAttr, "AttributeTableOfInteger")) {
334 // get table title in order to have default name of the file
337 _PTR(AttributeTableOfReal) aTabAttr (anAttr);
338 if (!aTabAttr) return;
339 aTitle = aTabAttr->GetTitle().c_str();
341 _PTR(AttributeTableOfInteger) aTabAttr (anAttr);
342 if (!aTabAttr) return;
343 aTitle = aTabAttr->GetTitle().c_str();
345 aTitle.simplifyWhiteSpace();
346 aTitle = aTitle.replace(QRegExp(" "), "_").replace(QRegExp("\\*"), "" );
348 // get default path for the file
349 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
350 QString aDir = aResourceMgr->stringValue("VISU","OutputDir","");
351 if (aDir.isEmpty()) {
352 aDir = aResourceMgr->stringValue("VISU","InputDir","");
353 if (aDir.isEmpty()) {
354 aDir = getenv("CSF_PATHData");
357 QString aPath = Qtx::addSlash(aDir) + aTitle;
359 // get name for the file
361 aFilter.append("Table Files (*.xls)");
363 QFileInfo aFileInfo =
364 SUIT_FileDlg::getFileName(GetDesktop(this),
367 tr("MEN_EXPORT_TABLE"), // "Export Table To File"
371 QString aFile = aFileInfo.filePath();
372 if (!aFile.isEmpty()) {
373 application()->putInfo(tr("MEN_EXPORT_TABLE") + " " + aFile + " ...");
374 aDir = Qtx::dir(aFile, true);
375 aResourceMgr->setValue("VISU", "OutputDir", aDir);
378 GetVisuGen(this)->ExportTableToFile(GetSObject(aSObj), aFile.latin1());
379 application()->putInfo(aFile + " " + tr("INF_DONE"));
380 } catch(std::exception& ex) {
382 SUIT_MessageBox::warn1(GetDesktop(this),
384 tr("ERR_ERROR_DURING_EXPORT") + " " + tr(ex.what()),
387 INFOS(tr("ERR_ERROR_DURING_EXPORT"));
388 SUIT_MessageBox::warn1(GetDesktop(this),
390 tr("ERR_ERROR_DURING_EXPORT"),
402 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
403 if (CheckLock(aCStudy))
405 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
407 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
408 SALOME_ListIO aListIO;
409 aSelectionMgr->selectedObjects(aListIO);
411 SALOME_ListIteratorOfListIO It (aListIO);
412 QApplication::setOverrideCursor(Qt::waitCursor);
413 for (; It.More(); It.Next()) {
414 Handle(SALOME_InteractiveObject) anIO = It.Value();
415 SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
416 if (!aSObject->_is_nil()) {
417 CORBA::Object_var anObject = VISU::SObjectToObject(aSObject);
418 if (!CORBA::is_nil(anObject)) {
419 SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
420 if (!CORBA::is_nil(aMED.in()))
421 GetVisuGen(this)->ImportMed(aSObject);
422 SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject);
423 if (!CORBA::is_nil(aField.in()))
424 GetVisuGen(this)->ImportMedField(aField);
426 SALOMEDS::SObject_var aSFather = aSObject->GetFather();
427 SALOMEDS::GenericAttribute_var anAttr;
428 aSFather->FindAttribute(anAttr, "AttributeName");
429 SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
430 CORBA::String_var aValue = aName->Value();
431 if (strcmp(aValue.in(), "MEDFIELD") == 0)
432 GetVisuGen(this)->ImportMed(aSObject);
436 UpdateObjBrowser(this, true);
437 QApplication::restoreOverrideCursor();
441 CreateCurves( SalomeApp_Module* theModule,
442 VISU::CutLines_i* thePrs,
444 const bool theCreate = true )
448 VisuGUI_CutLinesDlg* aCutDlg = dynamic_cast<VisuGUI_CutLinesDlg*>( theDlg );
452 _PTR(Study) aStudy = GetCStudy( GetAppStudy( theModule ) );
453 _PTR(SObject) aSObject = aStudy->FindObjectID( thePrs->GetEntry().latin1() );
455 if ( !theCreate && aSObject ) {
457 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
458 _PTR(ChildIterator) aIter = aStudy->NewChildIterator(aSObject);
459 for (; aIter->More(); aIter->Next()) {
460 _PTR(SObject) aTblObj = aIter->Value();
462 _PTR(GenericAttribute) anAttr;
463 if (aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
464 aBuilder->RemoveObjectWithChildren( aIter->Value() ); // We should have only one child
471 if ( aCutDlg->isGenerateTable() ) {
472 GetVisuGen( theModule )->CreateTable( thePrs->GetEntry() );
473 if ( aCutDlg->isGenerateCurves() ) {
475 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
476 _PTR(ChildIterator) aIter = aStudy->NewChildIterator(aSObject);
477 for (; aIter->More(); aIter->Next()) {
478 _PTR(SObject) aTblObj = aIter->Value();
480 _PTR(GenericAttribute) anAttr;
481 if ( aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
482 CreatePlot( theModule, aTblObj );
490 if (!theCreate && aSObject) {
491 UpdateObjBrowser(theModule);
499 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
500 if (CheckLock(aStudy))
503 // Get selected SObject
504 Handle(SALOME_InteractiveObject) anIO;
505 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
506 if (anIO.IsNull() || !anIO->hasEntry())
509 // create a VTK view window if it does not exist
510 GetViewWindow( this, /*create=*/true );
512 CreateMesh(this, anIO);
519 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
520 if (CheckLock(aStudy))
523 // create a VTK view window if it does not exist
524 GetViewWindow( this, /*create=*/true );
526 // Get selected SObject
527 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
528 SALOME_ListIO aListIO;
529 aSelectionMgr->selectedObjects(aListIO);
530 SALOME_ListIteratorOfListIO anIter (aListIO);
531 for (; anIter.More(); anIter.Next()) {
532 Handle(SALOME_InteractiveObject) anIO = anIter.Value();
533 if (anIO.IsNull() || !anIO->hasEntry())
536 CreateMesh(this, anIO);
544 CreatePrs3d<VISU::ScalarMap_i,VisuGUI_ScalarBarDlg,1>(this);
550 OnCreateDeformedShape()
552 CreatePrs3d<VISU::DeformedShape_i,VisuGUI_DeformedShapeDlg,1>(this);
559 CreatePrs3d<VISU::Vectors_i,VisuGUI_VectorsDlg,1>(this);
564 OnCreateIsoSurfaces()
566 CreatePrs3d<VISU::IsoSurfaces_i,VisuGUI_IsoSurfacesDlg,1>(this);
573 CreatePrs3d<VISU::CutPlanes_i,VisuGUI_CutPlanesDlg,0>(this);
580 CreatePrs3d<VISU::CutLines_i,VisuGUI_CutLinesDlg,0>(this);
585 OnCreateStreamLines()
587 CreatePrs3d<VISU::StreamLines_i,VisuGUI_StreamLinesDlg,1>(this);
594 CreatePrs3d<VISU::Plot3D_i,VisuGUI_Plot3DDlg,0>(this);
601 CheckLock(GetCStudy(GetAppStudy(this)));
602 GetVisuGen( this )->CreateContainer();
603 UpdateObjBrowser(this);
610 if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs");
612 QApplication::setOverrideCursor(Qt::waitCursor);
613 SALOME_ListIO aSel, aList;
614 LightApp_SelectionMgr* mgr = GetSelectionMgr(this);
615 mgr->selectedObjects( aSel );
617 extractContainers( aSel, aList );
619 Handle(SALOME_InteractiveObject) anIO;
620 for ( SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next() ) {
622 CORBA::Object_var anObject = GetSelectedObj( GetAppStudy(this), anIO->getEntry() );
623 if ( !CORBA::is_nil( anObject ) ) {
624 // is it Prs3d object ?
625 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
627 if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs : Prs3d object");
628 //UpdateViewer( this, aPrsObject );
629 SVTK_ViewWindow* vw = GetViewWindow( this, /*create=*/true );
632 displayer()->Display( anIO->getEntry() );
633 vw->highlight(anIO, 1);
638 VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(anObject).in());
640 if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs : Curve object");
641 //PlotCurve( this, aCurve, VISU::eDisplay );
642 displayer()->Display( anIO->getEntry() );
646 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(anObject).in());
648 if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Container object");
649 //PlotContainer( this, aContainer, VISU::eDisplay );
650 displayer()->Display( anIO->getEntry() );
654 VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(anObject).in());
656 if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Table object");
657 //PlotTable( this, aTable, VISU::eDisplay );
658 displayer()->Display( anIO->getEntry() );
663 SVTK_ViewWindow* vw = GetViewWindow( this );
665 vw->getRenderer()->ResetCameraClippingRange();
668 QApplication::restoreOverrideCursor();
683 if(MYDEBUG) MESSAGE("OnErasePrs");
685 QApplication::setOverrideCursor(Qt::waitCursor);
687 SVTK_ViewWindow* vw = GetViewWindow( this );
689 vw->unHighlightAll();
691 SALOME_ListIO aList, aSel;
692 LightApp_SelectionMgr* mgr = GetSelectionMgr(this);
693 mgr->selectedObjects( aSel );
695 extractContainers( aSel, aList );
697 Handle(SALOME_InteractiveObject) anIO;
698 for ( SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next() ) {
700 CORBA::Object_var anObject = GetSelectedObj( GetAppStudy(this), anIO->getEntry() );
701 if (!CORBA::is_nil(anObject))
702 RemoveScalarBarPosition(this,anObject);
703 ErasePrs( this, anObject, false );
709 QApplication::restoreOverrideCursor();
717 Handle(SALOME_InteractiveObject) anIO;
718 if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
719 EditPrs3d<VISU::ScalarMap_i, VisuGUI_ScalarBarDlg,1>(this, aPrs3d);
720 if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
721 aViewWindow->highlight(anIO, 1);
729 OnEditDeformedShape()
731 Handle(SALOME_InteractiveObject) anIO;
732 if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
733 EditPrs3d<VISU::DeformedShape_i, VisuGUI_DeformedShapeDlg,1>(this, aPrs3d);
734 if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
735 aViewWindow->highlight(anIO, 1);
745 Handle(SALOME_InteractiveObject) anIO;
746 if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
747 EditPrs3d<VISU::CutPlanes_i, VisuGUI_CutPlanesDlg,0>(this, aPrs3d);
748 if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
749 aViewWindow->highlight(anIO, 1);
759 Handle(SALOME_InteractiveObject) anIO;
760 if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
761 EditPrs3d<VISU::CutLines_i, VisuGUI_CutLinesDlg,0>(this, aPrs3d);
762 if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
763 aViewWindow->highlight(anIO, 1);
773 Handle(SALOME_InteractiveObject) anIO;
774 if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
775 EditPrs3d<VISU::IsoSurfaces_i, VisuGUI_IsoSurfacesDlg,1>(this, aPrs3d);
776 if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
777 aViewWindow->highlight(anIO, 1);
787 Handle(SALOME_InteractiveObject) anIO;
788 if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
789 EditPrs3d<VISU::Vectors_i, VisuGUI_VectorsDlg,1>(this, aPrs3d);
790 if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
791 aViewWindow->highlight(anIO, 1);
801 Handle(SALOME_InteractiveObject) anIO;
802 if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
803 EditPrs3d<VISU::StreamLines_i, VisuGUI_StreamLinesDlg,1>(this, aPrs3d);
804 if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
805 aViewWindow->highlight(anIO, 1);
815 Handle(SALOME_InteractiveObject) anIO;
816 if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
817 EditPrs3d<VISU::Plot3D_i, VisuGUI_Plot3DDlg,0>(this, aPrs3d);
818 if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
819 aViewWindow->highlight(anIO, 1);
829 startOperation( myEraseAll );
830 if (SVTK_ViewWindow* vw = GetViewWindow()) {
831 vw->unHighlightAll();
832 if (vtkRenderer *aRen = vw->getRenderer()) {
834 vtkActorCollection *anActColl = aRen->GetActors();
835 for (anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ) {
836 if (anActor->GetVisibility() > 0)
837 if (VISU_Actor* anVISUActor = VISU_Actor::SafeDownCast(anActor)) {
838 RemoveScalarBarPosition(this,anVISUActor->GetPrs3d());
839 anVISUActor = anVISUActor->GetParent();
840 RemoveScalarBarPosition(this,anVISUActor->GetPrs3d());
841 anVISUActor->VisibilityOff();
846 } else if (SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(this, false)) {
855 ChangeRepresentation(this, VISU::SURFACEFRAME);
862 ChangeRepresentation(this, VISU::INSIDEFRAME);
869 ChangeRepresentation(this, VISU::WIREFRAME);
876 ChangeRepresentation(this, VISU::SHADED);
883 ChangeRepresentation(this, VISU::POINT);
890 ChangeRepresentation(this, VISU::SHRINK);
897 SetShading(this, true);
904 SetShading(this, false);
911 Handle(SALOME_InteractiveObject) anIO;
912 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
913 if (CORBA::is_nil(anObject)) return;
914 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
915 if (!aServant.in()) return;
917 VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
920 SVTK_ViewWindow* vw = GetViewWindow();
923 VISU_Actor* anActor = GetActor(aPrs3d, vw);
924 if (!anActor) return;
926 VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
927 VISU::DeformedShape_i* aDeformedShape = dynamic_cast<VISU::DeformedShape_i*>(aPrs3d);
928 SALOMEDS::Color anOldColor, aNewColor;
929 int aRepresent = anActor->GetRepresentation();
931 switch (aRepresent) {
933 anOldColor = aMesh->GetNodeColor();
935 case VISU::WIREFRAME :
936 case VISU::INSIDEFRAME :
937 anOldColor = aMesh->GetLinkColor();
940 case VISU::SURFACEFRAME :
941 anOldColor = aMesh->GetCellColor();
944 } else if (aDeformedShape) {
945 anOldColor = aDeformedShape->GetColor();
950 QColor aColor (int(255*anOldColor.R),
951 int(255*anOldColor.G),
952 int(255*anOldColor.B));
953 QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
954 if (aColorNew.isValid()) {
955 aNewColor.R = aColorNew.red()/255.;
956 aNewColor.G = aColorNew.green()/255.;
957 aNewColor.B = aColorNew.blue()/255.;
959 switch (aRepresent) {
961 aMesh->SetNodeColor(aNewColor);
963 case VISU::WIREFRAME :
964 case VISU::INSIDEFRAME :
965 aMesh->SetLinkColor(aNewColor);
968 case VISU::SURFACEFRAME :
969 aMesh->SetCellColor(aNewColor);
973 aDeformedShape->SetColor(aNewColor);
975 RecreateActor(this, aPrs3d);
981 OnChangeWireframeColor()
983 Handle(SALOME_InteractiveObject) anIO;
984 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
985 if (CORBA::is_nil(anObject)) return;
986 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
987 if (!aServant.in()) return;
989 VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
992 SVTK_ViewWindow* vw = GetViewWindow();
995 VISU_Actor* anActor = GetActor(aPrs3d, vw);
996 if (!anActor) return;
998 if (VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d)) {
999 SALOMEDS::Color anOldColor = aMesh->GetLinkColor(), aNewColor;
1000 QColor aColor (int(255*anOldColor.R),
1001 int(255*anOldColor.G),
1002 int(255*anOldColor.B));
1003 QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
1004 if (aColorNew.isValid()) {
1005 aNewColor.R = aColorNew.red()/255.;
1006 aNewColor.G = aColorNew.green()/255.;
1007 aNewColor.B = aColorNew.blue()/255.;
1008 aMesh->SetLinkColor(aNewColor);
1009 RecreateActor(this, aMesh);
1018 Handle(SALOME_InteractiveObject) anIO;
1019 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1020 if (CORBA::is_nil(anObject)) return;
1021 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1022 if (!aServant.in()) return;
1024 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
1025 if (!aPrsObject) return;
1027 SVTK_ViewWindow* vw = GetViewWindow();
1030 VISU_Actor* anActor = GetActor(aPrsObject, vw);
1031 if (!anActor) return;
1033 VisuGUI_CursorDlg* CursorDlg =
1034 new VisuGUI_CursorDlg (GetDesktop(this), tr("DLG_OPACITY_TITLE"), TRUE);
1036 CursorDlg->Comment1->setText(tr("DLG_OPACITY_CMT1"));
1037 CursorDlg->Comment2->setText(tr("DLG_OPACITY_CMT2"));
1038 CursorDlg->SpinBox1->setMinValue(0);
1039 CursorDlg->SpinBox1->setMaxValue(100);
1041 float oldopac = anActor->GetOpacity();
1042 int intopac = int(oldopac*100. + 0.5);
1043 CursorDlg->SpinBox1->setValue(intopac);
1045 int ret = CursorDlg->exec();
1047 intopac = CursorDlg->SpinBox1->value();
1048 float newopac = intopac/100.;
1049 anActor->SetOpacity(newopac);
1058 Handle(SALOME_InteractiveObject) anIO;
1059 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1060 if (CORBA::is_nil(anObject)) return;
1061 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1062 if (!aServant.in()) return;
1064 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
1065 if (!aPrsObject) return;
1067 SVTK_ViewWindow* vw = GetViewWindow();
1070 VISU_Actor* anActor = GetActor(aPrsObject, vw);
1071 if (!anActor) return;
1073 VisuGUI_CursorDlg* CursorDlg =
1074 new VisuGUI_CursorDlg (GetDesktop(this), tr("DLG_LINEWIDTH_TITLE"), TRUE);
1076 CursorDlg->Comment1->setText(tr("DLG_LINEWIDTH_CMT1"));
1077 CursorDlg->Comment2->setText(tr("DLG_LINEWIDTH_CMT2"));
1078 CursorDlg->SpinBox1->setMinValue(1);
1079 CursorDlg->SpinBox1->setMaxValue(10);
1081 float oldlwid = anActor->GetLineWidth();
1082 int intlwid = int(oldlwid);
1083 CursorDlg->SpinBox1->setValue(intlwid);
1085 int ret = CursorDlg->exec();
1087 intlwid = CursorDlg->SpinBox1->value();
1088 float newlwid = intlwid;
1089 anActor->SetLineWidth(newlwid);
1098 Handle(SALOME_InteractiveObject) anIO;
1099 CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
1101 if ( !CORBA::is_nil( anObject ) ) {
1102 VISU::Base_var aVisuObj = VISU::Base::_narrow( anObject );
1103 if ( !CORBA::is_nil( aVisuObj ) && aVisuObj->GetType() == VISU::TTABLE ) {
1104 CORBA::Object_ptr aTable = VISU::Table::_narrow( anObject );
1105 if( !CORBA::is_nil( aTable ) ) {
1106 VISU::Table_i* table = dynamic_cast<VISU::Table_i*>( VISU::GetServant(aTable).in() );
1108 SO = GetCStudy( GetAppStudy( this ) )->FindObjectID( table->GetObjectEntry() );
1113 // possibly this is Table SObject
1114 SO = GetCStudy( GetAppStudy( this ) )->FindObjectID( anIO->getEntry() );
1117 if( !IsSObjectTable( SO ) )
1120 VisuGUI_TableDlg* dlg = new VisuGUI_TableDlg( GetDesktop( this ),
1123 //SAL2670 Orientation of show tables
1124 VisuGUI_TableDlg::ttAuto,
1133 Handle(SALOME_InteractiveObject) anIO;
1134 CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
1135 _PTR(Study) aStudy = GetCStudy( GetAppStudy( this ) );
1136 _PTR(SObject) aSObject = aStudy->FindObjectID(anIO->getEntry());
1137 VISU::CutLines_var aCutLines = VISU::CutLines::_narrow( anObject );
1138 if(!aCutLines->_is_nil() || IsSObjectTable(aSObject)) {
1139 GetVisuGen( this )->CreateTable( aSObject->GetID().c_str() );
1140 UpdateObjBrowser(this);
1148 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1149 if (CheckLock(aCStudy))
1152 SALOME_ListIO aList;
1153 LightApp_SelectionMgr* mgr = GetSelectionMgr(this);
1154 mgr->selectedObjects(aList,QString::null,false);
1155 int i = 0, nbSelected = aList.Extent();
1156 if (nbSelected < 1) return;
1158 const char* entries [nbSelected];
1159 Handle(SALOME_InteractiveObject) anIO;
1160 for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
1162 if (anIO->hasEntry())
1163 entries[i++] = anIO->getEntry();
1166 if (nbSelected < 1) return;
1168 // There is a transaction
1169 _PTR(StudyBuilder) aStudyBuilder = aCStudy->NewBuilder();
1170 aStudyBuilder->NewCommand();
1172 for (i = 0; i < nbSelected; i++) {
1173 _PTR(SObject) aSObject = aCStudy->FindObjectID(entries[i]);
1175 DeleteSObject(this, aCStudy, aSObject);
1179 // Finish transaction
1180 aStudyBuilder->CommitCommand();
1182 //GetActiveStudy()->unHighlightAll();
1183 UpdateObjBrowser(this, true);
1190 Handle(SALOME_InteractiveObject) anIO;
1191 CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
1193 _PTR(GenericAttribute) anAttr;
1194 _PTR(AttributeName) aName;
1196 _PTR(Study) aStudy = GetCStudy( GetAppStudy( this ) );
1198 if ( !CORBA::is_nil( anObject ) ) {
1199 VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
1200 if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TTABLE) {
1201 // Table (VISU object) is selected
1202 CORBA::Object_ptr aTbl = VISU::Table::_narrow( anObject );
1203 if( !CORBA::is_nil( aTbl ) ) {
1204 VISU::Table_i* table = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTbl).in());
1206 _PTR(SObject) SO = aStudy->FindObjectID( table->GetObjectEntry() );
1207 if ( IsSObjectTable(SO) ) {
1208 // get name of SObject
1209 if ( SO->FindAttribute( anAttr, "AttributeName" ) ) {
1211 SOName = QString( aName->Value().c_str() );
1213 VisuGUI_SetupPlot2dDlg* dlg = new VisuGUI_SetupPlot2dDlg( SO, GetDesktop( this ) );
1214 if ( dlg->exec() == QDialog::Accepted ) {
1215 if ( !IsStudyLocked( aStudy ) ) {
1216 // if study is not locked - create new container, create curves and insert them
1217 // into container, then plot container if current viewer is of VIEW_PLOT2D type
1219 QValueList<int> verIndices;
1220 dlg->getCurvesSource( horIndex, verIndices );
1221 if ( horIndex >= 0 && verIndices.count() > 0 ) {
1222 CORBA::Object_var aContainer = GetVisuGen(this)->CreateContainer();
1223 if( !CORBA::is_nil( aContainer ) ) {
1224 VISU::Container_i* pContainer =
1225 dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
1227 for ( int i = 0; i < verIndices.count(); i++ ) {
1228 CORBA::Object_var aNewCurve =
1229 GetVisuGen(this)->CreateCurve( table->_this(), horIndex+1, verIndices[i]+1 );
1230 if( !CORBA::is_nil( aNewCurve ) ) {
1231 VISU::Curve_i* pCrv =
1232 dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aNewCurve).in());
1235 int marker, line, lineWidth;
1237 if ( dlg->getCurveAttributes(verIndices[i], isAuto, marker,
1238 line, lineWidth, color) && !isAuto ) {
1240 c.R = color.red() /255.;
1241 c.G = color.green()/255.;
1242 c.B = color.blue() /255.;
1243 pCrv->SetColor( c );
1244 pCrv->SetMarker( ( VISU::Curve::MarkerType )marker );
1245 pCrv->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1247 pContainer->AddCurve( pCrv->_this() );
1251 UpdateObjBrowser(this);
1252 PlotContainer( this, pContainer, VISU::eDisplay );
1258 // if study is locked just get curves info and plot them
1259 // if current viewer is of VIEW_PLOT2D type
1260 QPtrList<Plot2d_Curve> container;
1261 dlg->getCurves( container );
1262 if ( !container.isEmpty() ) {
1263 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
1264 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( SOName );
1274 else if ( !anIO.IsNull() ) {
1275 // check if Table SObject is selected
1276 SO = aStudy->FindObjectID( anIO->getEntry() );
1277 if ( IsSObjectTable(SO) ) {
1278 // get name of SObject
1279 if ( SO->FindAttribute( anAttr, "AttributeName" ) ) {
1281 SOName = QString( aName->Value().c_str() );
1283 VisuGUI_SetupPlot2dDlg* dlg = new VisuGUI_SetupPlot2dDlg( SO, GetDesktop( this ) );
1284 if ( dlg->exec() == QDialog::Accepted ) {
1285 if ( !IsStudyLocked( aStudy ) ) {
1286 // if study is not locked - create new table and container objects, create curves
1287 // and insert them into container, then plot container if current viewer is of VIEW_PLOT2D type
1289 QValueList<int> verIndices;
1290 dlg->getCurvesSource( horIndex, verIndices );
1291 if ( horIndex >= 0 && verIndices.count() > 0 ) {
1292 CORBA::Object_var aTable = GetVisuGen(this)->CreateTable( SO->GetID().c_str() );
1293 CORBA::Object_var aContainer = GetVisuGen(this)->CreateContainer();
1294 if ( !CORBA::is_nil( aTable ) && !CORBA::is_nil( aContainer ) ) {
1295 VISU::Table_i* pTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTable).in());
1296 VISU::Container_i* pContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
1298 if ( pContainer && pTable ) {
1299 for ( int i = 0; i < verIndices.count(); i++ ) {
1300 CORBA::Object_var aNewCurve = GetVisuGen(this)->CreateCurve
1301 ( pTable->_this(), horIndex+1, verIndices[i]+1 );
1302 if( !CORBA::is_nil( aNewCurve ) ) {
1303 VISU::Curve_i* pCrv = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aNewCurve).in());
1306 int marker, line, lineWidth;
1308 if ( dlg->getCurveAttributes(verIndices[i], isAuto, marker,
1309 line, lineWidth, color) && !isAuto ) {
1311 c.R = color.red()/255.;
1312 c.G = color.green()/255.;
1313 c.B = color.blue()/255.;
1314 pCrv->SetColor( c );
1315 pCrv->SetMarker( ( VISU::Curve::MarkerType )marker );
1316 pCrv->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1318 pContainer->AddCurve( pCrv->_this() );
1322 UpdateObjBrowser(this);
1323 PlotContainer( this, pContainer, VISU::eDisplay );
1328 // if study is locked just get curves info and plot them
1329 QPtrList<Plot2d_Curve> container;
1330 dlg->getCurves( container );
1331 if ( !container.isEmpty() ) {
1332 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
1333 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( SOName );
1346 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1347 SALOME_ListIO aListIO;
1348 aSelectionMgr->selectedObjects(aListIO);
1349 if (aListIO.Extent() != 1) return;
1351 SalomeApp_Study* aAppStudy = GetAppStudy(this);
1352 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1353 CORBA::Object_var anObject = GetSelectedObj( aAppStudy, anIO->getEntry() );
1354 if (CORBA::is_nil( anObject )) return;
1356 VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
1357 if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TCURVE) {
1359 CORBA::Object_ptr aCurve = VISU::Curve::_narrow( anObject );
1360 if( !CORBA::is_nil( aCurve ) ) {
1361 VISU::Curve_i* aDSCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
1362 if ( aDSCurve && (!IsStudyLocked( GetCStudy(aAppStudy) )) ) {
1363 Plot2d_SetupCurveDlg aDlg(GetDesktop( this ));
1365 aDlg.setLine( (int)aDSCurve->GetLine(), aDSCurve->GetLineWidth() );
1366 aDlg.setMarker( (int)aDSCurve->GetMarker() );
1367 SALOMEDS::Color aColor = aDSCurve->GetColor();
1368 aDlg.setColor( QColor( (int)(aColor.R*255.), (int)(aColor.G*255.), (int)(aColor.B*255.) ) );
1369 if( aDlg.exec() == QDialog::Accepted ) {
1370 aDSCurve->SetLine( (VISU::Curve::LineType)aDlg.getLine(), aDlg.getLineWidth() );
1371 aDSCurve->SetMarker( (VISU::Curve::MarkerType)aDlg.getMarker());
1372 SALOMEDS::Color newColor;
1373 newColor.R = aDlg.getColor().red()/255.;
1374 newColor.G = aDlg.getColor().green()/255.;
1375 newColor.B = aDlg.getColor().blue()/255.;
1376 aDSCurve->SetColor( newColor );
1377 PlotCurve(this, aDSCurve, VISU::eDisplay);
1388 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1389 if (CheckLock(aCStudy))
1391 Handle(SALOME_InteractiveObject) anIO;
1392 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1393 if (anIO.IsNull() || CORBA::is_nil(anObject))
1396 VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
1397 if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TCONTAINER) {
1399 CORBA::Object_ptr aCnt = VISU::Container::_narrow(anObject);
1400 if (!CORBA::is_nil(aCnt)) {
1401 VISU::Container_i* container = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aCnt).in());
1402 if (container && container->GetNbCurves() > 0) {
1404 UpdateObjBrowser(this);
1414 Handle(SALOME_InteractiveObject) anIO;
1415 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1416 if (CORBA::is_nil(anObject)) return;
1418 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1419 if (!aServant.in()) return;
1420 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aServant.in());
1421 if (!aContainer) return;
1423 VisuGUI_EditContainerDlg* aDlg = new VisuGUI_EditContainerDlg (this);
1424 aDlg->initFromPrsObject(aContainer);
1426 aDlg->storeToPrsObject(aContainer);
1427 UpdateObjBrowser(this, true);
1436 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1437 if (CheckLock(aCStudy))
1440 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
1441 if (aViewMgr->getType() != SVTK_Viewer::Type())
1444 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1445 SALOME_ListIO aListIO;
1446 aSelectionMgr->selectedObjects(aListIO);
1447 if (aListIO.Extent() > 1)
1450 if (aListIO.Extent() == 0) {
1451 VISU::View3D_i::SaveViewParams(aViewMgr, VISU::View3D_i::GenerateViewParamsName().latin1());
1453 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1454 VISU::View3D_i::SaveViewParams(aViewMgr, anIO->getName());
1456 UpdateObjBrowser(this);
1461 OnRestoreViewParams()
1463 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
1464 if (aViewMgr->getType() != SVTK_Viewer::Type())
1467 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1468 SALOME_ListIO aListIO;
1469 aSelectionMgr->selectedObjects(aListIO);
1470 if (aListIO.Extent() != 1)
1473 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1474 //jfa tmp:VISU::View3D_i::RestoreViewParams(aViewMgr, anIO->getName());
1475 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));//jfa tmp
1476 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());//jfa tmp
1477 VISU::View3D_i::RestoreViewParams(aViewMgr, aSObj->GetName().c_str());//jfa tmp
1484 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1485 if (CheckLock(aCStudy))
1488 Handle(SALOME_InteractiveObject) anIO;
1489 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1491 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
1494 //TEST DU PARENT == VISU
1495 _PTR(StudyBuilder) aBuilder = aCStudy->NewBuilder();
1496 _PTR(GenericAttribute) anAttr = aBuilder->FindOrCreateAttribute(aSObj, "AttributeName");
1498 _PTR(AttributeName) aName (anAttr);
1499 QString Name = VisuGUI_NameDlg::getName( GetDesktop( this ), aName->Value().c_str() );
1500 if (!Name.isEmpty()) {
1501 QApplication::setOverrideCursor(Qt::waitCursor);
1503 // rename specific objects
1504 if (!CORBA::is_nil(anObject)) {
1505 VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
1506 if (!CORBA::is_nil(aVisuObj)) {
1507 switch (aVisuObj->GetType()) {
1508 case VISU::TCURVE: // Curve object
1510 CORBA::Object_ptr aCurve = VISU::Curve::_narrow(anObject);
1511 if (!CORBA::is_nil(aCurve)) {
1512 VISU::Curve_i* curve =
1513 dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
1515 curve->SetName(Name.latin1());
1519 case VISU::TTABLE: // Table object
1521 CORBA::Object_ptr aTable = VISU::Table::_narrow(anObject);
1522 if (!CORBA::is_nil(aTable)) {
1523 VISU::Table_i* table =
1524 dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTable).in());
1526 table->SetName(Name.latin1());
1530 case VISU::TCONTAINER: // Container object
1532 CORBA::Object_ptr aContainer = VISU::Container::_narrow(anObject);
1533 if (!CORBA::is_nil(aContainer)) {
1534 VISU::Container_i* container =
1535 dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
1537 container->SetName(Name.latin1());
1548 // rename the study object
1549 aName->SetValue(Name.latin1()); // rename the SObject
1550 anIO->setName(Name.latin1()); // rename the InteractiveObject
1552 ViewManagerList pvm_list;
1553 getApp()->viewManagers( SPlot2d_Viewer::Type(), pvm_list );
1554 for( SUIT_ViewManager* mgr = pvm_list.first(); mgr; mgr = pvm_list.next() )
1556 Plot2d_ViewManager* pvm = dynamic_cast<Plot2d_ViewManager*>( mgr );
1559 SPlot2d_Viewer* pv = dynamic_cast<SPlot2d_Viewer*>( pvm->getViewModel() );
1561 pv->renameAll( anIO, Name.latin1() );
1565 UpdateObjBrowser(this, false);
1567 QApplication::restoreOverrideCursor();
1576 new VisuGUI_ClippingDlg (this, "", false);
1584 Handle(SALOME_InteractiveObject) anIO;
1585 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1586 if (CORBA::is_nil(anObject)) return;
1587 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1588 if (!aServant.in()) return;
1590 VISU::ScalarMap_i* aPrsObject = dynamic_cast<VISU::ScalarMap_i*>(aServant.in());
1591 if (!aPrsObject) return;
1593 SVTK_ViewWindow* vw = GetViewWindow();
1596 VISU_Actor* aActor = GetActor(aPrsObject, vw);
1597 if (!aActor) return;
1599 if (!aActor->GetVisibility()) {
1600 aActor->VisibilityOn();
1603 // Get sweep parameters
1604 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
1606 double aTempoDbl = aResourceMgr->doubleValue("VISU", "sweeping_time_step", 0.1);
1607 int aTemp = int(1.E6 * aTempoDbl);
1609 int aCycles = aResourceMgr->integerValue("VISU", "sweeping_number_cycles", 1);
1610 int aSteps = aResourceMgr->integerValue("VISU", "sweeping_time_step", 40);
1613 QApplication::setOverrideCursor(Qt::waitCursor);
1614 for (int j = 0; j < aCycles; j++) {
1615 for (int i = 0; i <= aSteps; i++) {
1617 float aPercents = float(i)/aSteps;
1618 aPrsObject->SetMapScale(aPercents);
1619 aPrsObject->UpdateActor(aActor);
1620 vw->getRenderWindow()->getRenderWindow()->Render();
1622 } catch (std::exception& exc) {
1623 INFOS("Follow exception was occured :\n" << exc.what());
1625 INFOS("Unknown exception was occured!");
1629 QApplication::restoreOverrideCursor();
1636 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1637 VisuGUI_TimeAnimationDlg* aAnimationDlg =
1638 // new VisuGUI_TimeAnimationDlg(GetDesktop(this), aCStudy);
1639 new VisuGUI_TimeAnimationDlg (this, aCStudy);
1641 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1642 SALOME_ListIO aListIO;
1643 aSelectionMgr->selectedObjects(aListIO);
1645 bool isDefined = false;
1647 SALOME_ListIteratorOfListIO It (aListIO);
1648 for (; It.More(); It.Next()) {
1649 _PTR(SObject) aSObject = aCStudy->FindObjectID(It.Value()->getEntry());
1650 if (!aSObject) continue;
1651 if (getValue(aSObject, "myComment") == QString("FIELD")) {
1652 long aNumber = getValue(aSObject, "myNbTimeStamps").toLong();
1656 aAnimationDlg->addField(aSObject);
1658 } else if (aNbTimes == aNumber) {
1659 aAnimationDlg->addField(aSObject);
1664 if (isDefined) aAnimationDlg->show();
1665 else delete aAnimationDlg;
1668 //************************************************************************
1673 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1674 SALOME_ListIO aListIO;
1675 aSelectionMgr->selectedObjects(aListIO);
1677 if (aListIO.Extent() != 1)
1680 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1682 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1684 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
1687 VISU::Storable::TRestoringMap aMap;
1688 _PTR(GenericAttribute) anAttr;
1689 if (!aSObj->FindAttribute(anAttr, "AttributeComment")) return;
1691 _PTR(AttributeComment) aComment (anAttr);
1692 string aComm = aComment->Value();
1693 QString strIn (aComm.c_str());
1694 VISU::Storable::StrToMap(strIn, aMap);
1696 VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
1697 if (aType != VISU::TANIMATION) return;
1699 VisuGUI_TimeAnimationDlg* aAnimationDlg =
1700 new VisuGUI_TimeAnimationDlg(this, aCStudy);
1701 aAnimationDlg->restoreFromStudy(aSObj);
1702 aAnimationDlg->show();
1707 OnCopyPresentation()
1709 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1710 if (CheckLock(aCStudy))
1713 Handle(SALOME_InteractiveObject) anIO;
1714 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1715 if (CORBA::is_nil(anObject)) return;
1716 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1717 if (!aServant.in()) return;
1719 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
1720 if (!aPrsObject) return;
1722 switch (aPrsObject->GetType()) {
1725 VISU::Mesh_i* aMeshPrs = dynamic_cast<VISU::Mesh_i*>(aPrsObject);
1726 VISU::Mesh_i* aSameMesh = new VISU::Mesh_i(aMeshPrs->GetResult());
1727 aSameMesh->SameAs(aMeshPrs);
1728 UpdateViewer(this, aSameMesh);
1731 case VISU::TSCALARMAP:
1733 VISU::ScalarMap_i* aScalarPrs = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
1734 VISU::ScalarMap_i* aSameScalar = new VISU::ScalarMap_i(aScalarPrs->GetResult(),true);
1735 aSameScalar->SameAs(aScalarPrs);
1736 UpdateViewer(this, aSameScalar);
1739 case VISU::TDEFORMEDSHAPE:
1741 VISU::DeformedShape_i* aDefPrs = dynamic_cast<VISU::DeformedShape_i*>(aPrsObject);
1742 VISU::DeformedShape_i* aSameDeformed = new VISU::DeformedShape_i(aDefPrs->GetResult(),true);
1743 aSameDeformed->SameAs(aDefPrs);
1744 UpdateViewer(this, aSameDeformed);
1747 case VISU::TCUTPLANES:
1749 VISU::CutPlanes_i* aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
1750 VISU::CutPlanes_i* aSameCut = new VISU::CutPlanes_i(aCutPrs->GetResult(),true);
1751 aSameCut->SameAs(aCutPrs);
1752 UpdateViewer(this, aSameCut);
1755 case VISU::TCUTLINES:
1757 VISU::CutLines_i* aCutPrs = dynamic_cast<VISU::CutLines_i*>(aPrsObject);
1758 VISU::CutLines_i* aSameCut = new VISU::CutLines_i(aCutPrs->GetResult(),true);
1759 aSameCut->SameAs(aCutPrs);
1760 UpdateViewer(this, aSameCut);
1763 case VISU::TISOSURFACE:
1765 VISU::IsoSurfaces_i* aIsoPrs = dynamic_cast<VISU::IsoSurfaces_i*>(aPrsObject);
1766 VISU::IsoSurfaces_i* aSameIso = new VISU::IsoSurfaces_i(aIsoPrs->GetResult(),true);
1767 aSameIso->SameAs(aIsoPrs);
1768 UpdateViewer(this, aSameIso);
1771 case VISU::TSTREAMLINES:
1773 VISU::StreamLines_i* aLinesPrs = dynamic_cast<VISU::StreamLines_i*>(aPrsObject);
1774 VISU::StreamLines_i* aSameLines = new VISU::StreamLines_i(aLinesPrs->GetResult(),true);
1775 aSameLines->SameAs(aLinesPrs);
1776 UpdateViewer(this, aSameLines);
1779 case VISU::TVECTORS:
1781 VISU::Vectors_i* aVectorsPrs = dynamic_cast<VISU::Vectors_i*>(aPrsObject);
1782 VISU::Vectors_i* aSameVectors = new VISU::Vectors_i(aVectorsPrs->GetResult(),true);
1783 aSameVectors->SameAs(aVectorsPrs);
1784 UpdateViewer(this, aSameVectors);
1789 VISU::Plot3D_i* aPlot3DPrs = dynamic_cast<VISU::Plot3D_i*>(aPrsObject);
1790 VISU::Plot3D_i* aSamePlot3D = new VISU::Plot3D_i(aPlot3DPrs->GetResult());
1791 aSamePlot3D->SameAs(aPlot3DPrs);
1792 UpdateViewer(this, aSamePlot3D);
1796 UpdateObjBrowser(this);
1803 if (GetViewWindow())
1804 (new VisuGUI_SelectionDlg(GetDesktop(this)))->show();
1806 SUIT_MessageBox::warn1(GetDesktop(this),
1808 tr("ERR_ACTIVATE_VIEW3D"),
1816 VisuGUI_NonIsometricDlg* m_NonIsoDlg =
1817 new VisuGUI_NonIsometricDlg (GetDesktop(this), "m_NonIsoDlg",
1818 false, Qt::WDestructiveClose);
1819 m_NonIsoDlg->show();
1826 //Show dialog that allows to select scale function and corresponding scale factor
1827 VisuGUI_CubeAxesDlg* aDlg = new VisuGUI_CubeAxesDlg (GetDesktop(this));
1835 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1836 SALOME_ListIO aListIO;
1837 aSelectionMgr->selectedObjects(aListIO);
1839 SALOME_ListIteratorOfListIO It (aListIO);
1841 // first find the bounds
1842 double aMin, aMax; bool first = true;
1843 for (; It.More(); It.Next()) {
1844 Handle(SALOME_InteractiveObject)& anIO = It.Value();
1845 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
1846 if (!aPrsList.empty()) {
1847 for (int i = 0, n = aPrsList.size(); i < n; i++) {
1848 VISU::Prs3d_i* aPrsObject = aPrsList[i];
1850 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
1854 aMin = aScalar->GetMin(); aMax = aScalar->GetMax();
1856 if (aScalar->GetMin() < aMin) aMin = aScalar->GetMin();
1857 if (aScalar->GetMax() > aMax) aMax = aScalar->GetMax();
1865 // set the computed range to every selected ScalarMap
1866 bool update = false;
1867 for (It.Initialize(aListIO); It.More(); It.Next() ) {
1868 Handle(SALOME_InteractiveObject)& anIO = It.Value();
1869 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
1870 if (!aPrsList.empty()) {
1871 for (int i = 0, n = aPrsList.size(); i < n; i++) {
1872 VISU::Prs3d_i* aPrsObject = aPrsList[i];
1874 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
1876 aScalar->SetRange(aMin, aMax);
1877 RecreateActor(this, aScalar);
1885 if (SVTK_ViewWindow* vw = GetViewWindow(this)) {
1886 //if (vw->getRenderer()->GetActors()->GetNumberOfItems() > 0) {
1887 vw->getRenderer()->ResetCameraClippingRange();
1898 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1899 SALOME_ListIO aListIO;
1900 aSelectionMgr->selectedObjects(aListIO);
1902 SALOME_ListIteratorOfListIO It (aListIO);
1904 // restore the source range for every ScalarMap
1905 bool update = false;
1906 for (; It.More(); It.Next()) {
1907 Handle(SALOME_InteractiveObject)& anIO = It.Value();
1908 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
1909 if (!aPrsList.empty()) {
1910 for (int i = 0, n = aPrsList.size(); i < n; i++) {
1911 VISU::Prs3d_i* aPrsObject = aPrsList[i];
1913 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
1915 aScalar->SetSourceRange();
1916 RecreateActor(this, aScalar);
1924 if (SVTK_ViewWindow* vw = GetViewWindow(this)) {
1925 //if (vw->getRenderer()->GetActors()->GetNumberOfItems() > 0) {
1926 vw->getRenderer()->ResetCameraClippingRange();
1937 if(MYDEBUG) MESSAGE("VisuGUI::OnTranslatePrs");
1938 VisuGUI_OffsetDlg* aDlg = new VisuGUI_OffsetDlg (this);
1940 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1942 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1943 SALOME_ListIO aListIO;
1944 aSelectionMgr->selectedObjects(aListIO);
1946 SALOME_ListIteratorOfListIO It (aListIO);
1947 for (; It.More(); It.Next()) {
1948 Handle(SALOME_InteractiveObject)& anIO = It.Value();
1949 if (anIO->hasEntry()) {
1950 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
1952 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSObject);
1953 if (!CORBA::is_nil(aCORBAObject)) {
1954 PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
1955 if (VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in())) {
1956 aDlg->addPresentation(aPrsObject);
1962 if (aDlg->getPrsCount() > 0)
1972 SVTK_ViewWindow* vw = GetViewWindow();
1974 ArrangeDlg* aDlg = new ArrangeDlg (GetDesktop(this), vw);
1983 initialize( CAM_Application* theApp )
1985 SalomeApp_Module::initialize( theApp );
1998 QWidget* aParent = application()->desktop();
1999 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
2002 createAction( VISU_IMPORT_FROM_FILE, "", QIconSet(),
2003 tr("MEN_IMPORT_FROM_FILE"), "", (CTRL + Key_I), aParent, false,
2004 this, SLOT(OnImportFromFile()));
2006 createAction( VISU_EXPLORE_MED, "", QIconSet(),
2007 tr("MEN_EXPLORE_MED_FILE"), "", (CTRL + Key_M), aParent, false,
2008 this, SLOT(OnExploreMEDFile()));
2010 createAction( VISU_IMPORT_TABLE, "", QIconSet(),
2011 tr("MEN_IMPORT_TABLE"), "", 0, aParent, false,
2012 this, SLOT(OnImportTableFromFile()));
2014 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP"));
2015 createAction( VISU_SCALAR_MAP, tr("MEN_SCALAR_MAP"), QIconSet(aPixmap),
2016 tr("MEN_SCALAR_MAP"), "", 0, aParent, false,
2017 this, SLOT(OnCreateScalarMap()));
2019 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_DEFORMED_SHAPE"));
2020 createAction( VISU_DEFORMED_SHAPE, tr("MEN_DEFORMED_SHAPE"), QIconSet(aPixmap),
2021 tr("MEN_DEFORMED_SHAPE"), "", 0, aParent, false,
2022 this, SLOT(OnCreateDeformedShape()));
2024 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_VECTORS"));
2025 createAction( VISU_VECTORS, tr("MEN_VECTORS"), QIconSet(aPixmap),
2026 tr("MEN_VECTORS"), "", 0, aParent, false,
2027 this, SLOT(OnCreateVectors()));
2029 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ISO_SURFACES"));
2030 createAction( VISU_ISO_SURFACES, tr("MEN_ISO_SURFACES"), QIconSet(aPixmap),
2031 tr("MEN_ISO_SURFACES"), "", 0, aParent, false,
2032 this, SLOT(OnCreateIsoSurfaces()));
2034 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_PLANES"));
2035 createAction( VISU_CUT_PLANES, tr("MEN_CUT_PLANES"), QIconSet(aPixmap),
2036 tr("MEN_CUT_PLANES"), "", 0, aParent, false,
2037 this, SLOT(OnCreateCutPlanes()));
2039 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_STREAM_LINES"));
2040 createAction( VISU_STREAM_LINES, tr("MEN_STREAM_LINES"), QIconSet(aPixmap),
2041 tr("MEN_STREAM_LINES"), "", 0, aParent, false,
2042 this, SLOT(OnCreateStreamLines()));
2044 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_LINES"));
2045 createAction( VISU_CUT_LINES, tr("MEN_CUT_LINES"), QIconSet(aPixmap),
2046 tr("MEN_CUT_LINES"), "", 0, aParent, false,
2047 this, SLOT(OnCreateCutLines()));
2049 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT_3D"));
2050 createAction( VISU_PLOT_3D, tr("MEN_PLOT_3D"), QIconSet(aPixmap),
2051 tr("MEN_PLOT_3D"), "", 0, aParent, false,
2052 this, SLOT(OnCreatePlot3D()));
2054 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT2D"));
2055 createAction( VISU_PLOT2D, tr("MEN_CREATE_PLOT2D"), QIconSet(aPixmap),
2056 tr("MEN_CREATE_PLOT2D"), "", 0, aParent, false,
2057 this, SLOT(OnCreatePlot2dView()));
2059 createAction( VISU_DELETE_OBJS, tr("MEN_DELETE_OBJS"), QIconSet(),
2060 tr("MEN_DELETE_OBJS"), "", 0, aParent, false,
2061 this, SLOT(OnDeleteObjects()));
2063 createAction( VISU_SHOW_TABLE, tr("MEN_SHOW_TABLE"), QIconSet(),
2064 tr("MEN_SHOW_TABLE"), "", 0, aParent, false,
2065 this, SLOT(OnShowTable()));
2067 createAction( VISU_CREATE_CURVES, tr("MEN_CREATE_CURVES"), QIconSet(),
2068 tr("MEN_CREATE_CURVES"), "", 0, aParent, false,
2069 this, SLOT(OnPlotData()));
2071 createAction( VISU_EXPORT_TABLE, tr("MEN_EXPORT_TABLE"), QIconSet(),
2072 tr("MEN_EXPORT_TABLE"), "", 0, aParent, false,
2073 this, SLOT(OnExportTableToFile()));
2075 createAction( VISU_IMPORT_MED_STRUCTURE, tr("MEN_IMPORT_MED_STRUCTURE"), QIconSet(),
2076 tr("MEN_IMPORT_MED_STRUCTURE"), "", 0, aParent, false,
2077 this, SLOT(OnImportMedField()));
2079 createAction( VISU_IMPORT_MED_TIMESTAMP, tr("MEN_IMPORT_MED_TIMESTAMP"), QIconSet(),
2080 tr("MEN_IMPORT_MED_TIMESTAMP"), "", 0, aParent, false,
2081 this, SLOT(OnImportMedField()));
2083 createAction( VISU_IMPORT_MED_FIELD, tr("MEN_IMPORT_MED_FIELD"), QIconSet(),
2084 tr("MEN_IMPORT_MED_FIELD"), "", 0, aParent, false,
2085 this, SLOT(OnImportMedField()));
2087 createAction( VISU_CREATE_PRS, tr("MEN_CREATE_PRS"), QIconSet(),
2088 tr("MEN_CREATE_PRS"), "", 0, aParent, false,
2089 this, SLOT(OnCreateMesh()));
2091 createAction( VISU_CREATE_MANY_PRS, tr("MEN_CREATE_MANY_PRS"), QIconSet(),
2092 tr("MEN_CREATE_MANY_PRS"), "", 0, aParent, false,
2093 this, SLOT(OnCreateManyMesh()));
2095 createAction( VISU_TRANSLATE_PRS, tr("MEN_TRANSLATE_PRS"), QIconSet(),
2096 tr("MEN_TRANSLATE_PRS"), "", 0, aParent, false,
2097 this, SLOT(OnTranslatePrs()));
2099 createAction( VISU_MERGE_SCALAR_BARS, tr("MEN_MERGE_SCALAR_BARS"), QIconSet(),
2100 tr("MEN_MERGE_SCALAR_BARS"), "", 0, aParent, false,
2101 this, SLOT(OnMergeScalarBars()));
2103 createAction( VISU_FREE_SCALAR_BARS, tr("MEN_FREE_SCALAR_BARS"), QIconSet(),
2104 tr("MEN_FREE_SCALAR_BARS"), "", 0, aParent, false,
2105 this, SLOT(OnFreeScalarBars()));
2107 createAction( VISU_ERASE, tr("MEN_ERASE"), QIconSet(),
2108 tr("MEN_ERASE"), "", 0, aParent, false,
2109 this, SLOT(OnErasePrs()));
2111 createAction( VISU_DISPLAY, tr("MEN_DISPLAY"), QIconSet(),
2112 tr("MEN_DISPLAY"), "", 0, aParent, false,
2113 this, SLOT(OnDisplayPrs()));
2115 createAction( VISU_DISPLAY_ONLY, tr("MEN_DISPLAY_ONLY"), QIconSet(),
2116 tr("MEN_DISPLAY_ONLY"), "", 0, aParent, false,
2117 this, SLOT(OnDisplayOnlyPrs()));
2119 createAction( VISU_COPY_PRS, tr("MEN_COPY_PRS"), QIconSet(),
2120 tr("MEN_COPY_PRS"), "", 0, aParent, false,
2121 this, SLOT(OnCopyPresentation()));
2123 createAction( VISU_CURVE_PROPS, tr("MEN_CURVE_PROPS"), QIconSet(),
2124 tr("MEN_CURVE_PROPS"), "", 0, aParent, false,
2125 this, SLOT(OnCurveProperties()));
2127 createAction( VISU_RENAME, tr("MEN_RENAME"), QIconSet(), tr("MEN_RENAME"), "", 0, aParent, false,
2128 this, SLOT(OnRename()));
2130 createAction( VISU_EDIT_CONTAINER, tr("MEN_EDIT_CONTAINER"), QIconSet(),
2131 tr("MEN_EDIT_CONTAINER"), "", 0, aParent, false,
2132 this, SLOT(OnEditContainer()));
2134 createAction( VISU_CLEAR_CONTAINER, tr("MEN_CLEAR_CONTAINER"), QIconSet(),
2135 tr("MEN_CLEAR_CONTAINER"), "", 0, aParent, false,
2136 this, SLOT(OnClearContainer()));
2138 createAction( VISU_SAVE_VIEW_PARAMS, tr("MEN_SAVE_VIEWPARAMS"), QIconSet(),
2139 tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
2140 this, SLOT(OnSaveViewParams()));
2141 createAction( VISU_SAVE_VIEW_PARAMS_1, tr("MEN_SAVE_VIEWPARAMS"), QIconSet(),
2142 tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
2143 this, SLOT(OnSaveViewParams()));
2145 createAction( VISU_RESTORE_VIEW_PARAMS, tr("MEN_RESTORE_VIEWPARAMS"), QIconSet(),
2146 tr("MEN_RESTORE_VIEWPARAMS"), "", 0, aParent, false,
2147 this, SLOT(OnRestoreViewParams()));
2149 //createAction( VISU_DELETE_VIEW_PARAMS, tr("MEN_DELETE_VIEWPARAMS"), QIconSet(),
2150 // tr("MEN_DELETE_VIEWPARAMS"), "", 0, aParent, false,
2151 // this, SLOT(OnDeleteObjects()));
2153 createAction( VISU_ARRANGE_ACTORS, tr("MEN_ARRANGE_ACTORS"), QIconSet(),
2154 tr("MEN_ARRANGE_ACTORS"), "", 0, aParent, false,
2155 this, SLOT(OnArrangeActors()));
2157 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_POINTS"));
2158 createAction( VISU_POINTS, tr("MEN_POINTS"), QIconSet(aPixmap),
2159 tr("MEN_POINTS"), "", 0, aParent, false,
2160 this, SLOT(OnMakePoints()));
2162 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_WIREFRAME"));
2163 createAction( VISU_WIREFRAME, tr("MEN_WIREFRAME"), QIconSet(aPixmap),
2164 tr("MEN_WIREFRAME"), "", 0, aParent, false,
2165 this, SLOT(OnMakeWireframe()));
2167 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SURFACE"));
2168 createAction( VISU_SURFACE, tr("MEN_SURFACE"), QIconSet(aPixmap),
2169 tr("MEN_SURFACE"), "", 0, aParent, false,
2170 this, SLOT(OnMakeSurface()));
2172 createAction( VISU_INSIDEFRAME, tr("MEN_INSIDEFRAME"), QIconSet(),
2173 tr("MEN_INSIDEFRAME"), "", 0, aParent, false,
2174 this, SLOT(OnMakeInsideframe()));
2176 createAction( VISU_SURFACEFRAME, tr("MEN_SURFACEFRAME"), QIconSet(),
2177 tr("MEN_SURFACEFRAME"), "", 0, aParent, false,
2178 this, SLOT(OnMakeSurfaceframe()));
2180 createAction( VISU_SHRINK, tr("MEN_SHRINK"), QIconSet(),
2181 tr("MEN_SHRINK"), "", 0, aParent, false,
2182 this, SLOT(OnMakeShrink()));
2184 createAction( VISU_UNSHRINK, tr("MEN_UNSHRINK"), QIconSet(),
2185 tr("MEN_UNSHRINK"), "", 0, aParent, false,
2186 this, SLOT(OnMakeShrink()));
2188 createAction( VISU_SHADING, tr("MEN_SHADING"), QIconSet(),
2189 tr("MEN_SHADING"), "", 0, aParent, false,
2190 this, SLOT(OnSetShadingOn()));
2192 createAction( VISU_NOSHADING, tr("MEN_NOSHADING"), QIconSet(),
2193 tr("MEN_NOSHADING"), "", 0, aParent, false,
2194 this, SLOT(OnSetShadingOff()));
2196 createAction( VISU_CELL_COLOR, tr("MEN_CELL_COLOR"), QIconSet(),
2197 tr("MEN_CELL_COLOR"), "", 0, aParent, false,
2198 this, SLOT(OnChangeColor()));
2200 createAction( VISU_COLOR, tr("MEN_COLOR"), QIconSet(),
2201 tr("MEN_COLOR"), "", 0, aParent, false,
2202 this, SLOT(OnChangeColor()));
2204 createAction( VISU_EDGE_COLOR, tr("MEN_EDGE_COLOR"), QIconSet(),
2205 tr("MEN_EDGE_COLOR"), "", 0, aParent, false,
2206 this, SLOT(OnChangeWireframeColor()));
2208 createAction( VISU_OPACITY, tr("MEN_OPACITY"), QIconSet(),
2209 tr("MEN_OPACITY"), "", 0, aParent, false,
2210 this, SLOT(OnChangeOpacity()));
2212 createAction( VISU_LINE_WIDTH, tr("MEN_LINE_WIDTH"), QIconSet(),
2213 tr("MEN_LINE_WIDTH"), "", 0, aParent, false,
2214 this, SLOT(OnChangeLines()));
2217 createAction( VISU_EDIT_SCALARMAP, tr("MEN_EDIT_PRS"), QIconSet(),
2218 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2219 this, SLOT(OnEditScalarMap()));
2221 createAction( VISU_EDIT_DEFORMEDSHAPE, tr("MEN_EDIT_PRS"), QIconSet(),
2222 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2223 this, SLOT(OnEditDeformedShape()));
2225 createAction( VISU_EDIT_CUTPLANES, tr("MEN_EDIT_PRS"), QIconSet(),
2226 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2227 this, SLOT(OnEditCutPlanes()));
2229 createAction( VISU_EDIT_CUTLINES, tr("MEN_EDIT_PRS"), QIconSet(),
2230 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2231 this, SLOT(OnEditCutLines()));
2233 createAction( VISU_EDIT_ISOSURFACE, tr("MEN_EDIT_PRS"), QIconSet(),
2234 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2235 this, SLOT(OnEditIsoSurfaces()));
2237 createAction( VISU_EDIT_VECTORS, tr("MEN_EDIT_PRS"), QIconSet(),
2238 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2239 this, SLOT(OnEditVectors()));
2241 createAction( VISU_EDIT_STREAMLINES, tr("MEN_EDIT_PRS"), QIconSet(),
2242 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2243 this, SLOT(OnEditStreamLines()));
2245 createAction( VISU_EDIT_PLOT3D, tr("MEN_EDIT_PRS"), QIconSet(),
2246 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2247 this, SLOT(OnEditPlot3D()));
2250 createAction( VISU_CREATE_TABLE, tr("MEN_CREATE_TABLE"), QIconSet(),
2251 tr("MEN_CREATE_TABLE"), "", 0, aParent, false,
2252 this, SLOT(OnCreateTable()));
2254 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SWEEP"));
2255 createAction( VISU_SWEEP, tr("MEN_SWEEP"), QIconSet(aPixmap),
2256 tr("MEN_SWEEP"), "", 0, aParent, false,
2257 this, SLOT(OnSweep()));
2259 createAction( VISU_CLIPPING, tr("MEN_CLIPPING"), QIconSet(),
2260 tr("MEN_CLIPPING"), "", 0, aParent, false,
2261 this, SLOT(OnClippingPlanes()));
2263 createAction( VISU_SELECTION_INFO, tr("MEN_SELECTION_INFO"), QIconSet(),
2264 tr("MEN_SELECTION_INFO"), "", 0, aParent, false,
2265 this, SLOT(OnSelectionInfo()));
2267 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_TIMEANIMATION"));
2268 createAction( VISU_ANIMATION, tr("MEN_ANIMATION"), QIconSet(aPixmap),
2269 tr("MEN_ANIMATION"), "", 0, aParent, false,
2270 this, SLOT(OnTimeAnimation()));
2272 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ERASE_ALL"));
2273 createAction( VISU_ERASE_ALL, tr("MEN_ERASE_ALL"), QIconSet(aPixmap),
2274 tr("MEN_ERASE_ALL"), "", 0, aParent, false,
2275 this, SLOT(OnEraseAll()));
2277 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_GLOBAL_SELECTION"));
2278 createAction( VISU_GLOBAL_SELECTION, tr("MEN_GLOBAL_SELECTION"), QIconSet(aPixmap),
2279 tr("MEN_GLOBAL_SELECTION"), "", 0, aParent, false,
2280 //this, SLOT(OnEraseAll()));
2283 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PARTIAL_SELECTION"));
2284 createAction( VISU_PARTIAL_SELECTION, tr("MEN_PARTIAL_SELECTION"), QIconSet(aPixmap),
2285 tr("MEN_PARTIAL_SELECTION"), "", 0, aParent, false,
2286 //this, SLOT(OnEraseAll()));
2289 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALING"));
2290 createAction( VISU_SCALING, tr("MEN_SCALING"), QIconSet(aPixmap),
2291 tr("MEN_SCALING"), "", 0, aParent, false,
2292 this, SLOT(OnScaling()));
2294 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUBE_AXES"));
2295 createAction( VISU_CUBE_AXES, tr("MEN_CUBE_AXES"), QIconSet(aPixmap),
2296 tr("MEN_CUBE_AXES"), "", 0, aParent, false,
2297 this, SLOT(OnCubeAxes()));
2299 createAction( VISU_SHOW_ANIMATION, tr("MEN_SHOW_ANIMATION"), QIconSet(),
2300 tr("MEN_SHOW_ANIMATION"), "", 0, aParent, false,
2301 this, SLOT(OnShowAnimation()));
2308 // Add actions to menus
2310 aMenuId = createMenu( tr( "MEN_DESK_FILE" ), -1 );
2311 createMenu( separator(), aMenuId, -1, 10 );
2312 createMenu( VISU_IMPORT_FROM_FILE, aMenuId, 10 ); // import from file
2313 createMenu( VISU_EXPLORE_MED, aMenuId, 10 ); // explore MED file
2314 createMenu( VISU_IMPORT_TABLE, aMenuId, 10 ); // import table
2316 aMenuId = createMenu( tr( "MEN_VISUALIZATION" ), -1, -1, 30 );
2317 createMenu( VISU_SCALAR_MAP, aMenuId, 10 ); // scalar map
2318 createMenu( VISU_DEFORMED_SHAPE, aMenuId, 10 ); // deformed shape
2319 createMenu( VISU_VECTORS, aMenuId, 10 ); // vectors
2320 createMenu( VISU_ISO_SURFACES, aMenuId, 10 ); // iso surfaces
2321 createMenu( VISU_CUT_PLANES, aMenuId, 10 ); // cut planes
2322 createMenu( VISU_CUT_LINES, aMenuId, 10 ); // cut lines
2323 createMenu( VISU_STREAM_LINES, aMenuId, 10 ); // stream lines
2324 createMenu( VISU_PLOT_3D, aMenuId, 10 ); // Plot3d
2326 aMenuId = createMenu( tr( "MEN_SELECTION" ), -1, -1, 30 );
2327 createMenu( VISU_SELECTION_INFO, aMenuId, 10 ); // selection info
2329 aMenuId = createMenu( tr( "MEN_REPRESENTATION" ), -1, -1, 30 );
2331 createMenu( tr( "MEN_DISPLAY_SELECTION" ), aMenuId, 10 ); // display selection
2332 createMenu( VISU_POINTS, parentId, 10 ); // points
2333 createMenu( VISU_WIREFRAME, parentId, 10 ); // wireframe
2334 createMenu( VISU_SURFACE, parentId, 10 ); // surface
2335 createMenu( VISU_ERASE_ALL, aMenuId, 10 ); // erase all
2336 createMenu( VISU_GLOBAL_SELECTION, aMenuId, 10 ); // global selection
2337 createMenu( VISU_PARTIAL_SELECTION, aMenuId, 10 ); // partial selection
2338 createMenu( VISU_SCALING, aMenuId, 10 ); // scaling
2339 createMenu( VISU_CUBE_AXES, aMenuId, 10 ); // scaling
2346 int aToolId = createTool(tr("TOOL_VISUALISATION"));
2347 createTool( VISU_SCALAR_MAP, aToolId );
2348 createTool( VISU_DEFORMED_SHAPE, aToolId );
2349 createTool( VISU_VECTORS, aToolId );
2350 createTool( VISU_ISO_SURFACES, aToolId );
2351 createTool( VISU_CUT_PLANES, aToolId );
2352 createTool( VISU_CUT_LINES, aToolId );
2353 createTool( VISU_STREAM_LINES, aToolId );
2354 createTool( VISU_PLOT_3D, aToolId );
2356 aToolId = createTool(tr("TOOL_REPRESENTATION"));
2357 createTool( VISU_POINTS, aToolId );
2358 createTool( VISU_WIREFRAME, aToolId );
2359 createTool( VISU_SURFACE, aToolId );
2360 createTool( VISU_ERASE_ALL, aToolId );
2361 createTool( VISU_GLOBAL_SELECTION, aToolId );
2362 createTool( VISU_PARTIAL_SELECTION, aToolId );
2363 createTool( VISU_SCALING, aToolId );
2364 createTool( VISU_CUBE_AXES, aToolId );
2371 // Prepare popup menus
2372 QtxPopupMgr* mgr = popupMgr();
2374 // VISU root commands
2375 mgr->insert( action( VISU_IMPORT_FROM_FILE ), -1, -1, -1 ); // import MED file
2376 mgr->insert( action( VISU_IMPORT_TABLE ), -1, -1, -1 ); // import tables from file
2377 mgr->insert( action( VISU_PLOT2D ), -1, -1, -1 ); // create Plot2d View
2379 //mgr->insert( action( VISU_IMPORT_MED ), -1, -1, -1 ); // import MED structure from MED module
2382 mgr->insert( action( VISU_SCALAR_MAP ), -1, -1, -1 ); // scalar bar
2383 mgr->insert( action( VISU_ISO_SURFACES ), -1, -1, -1 ); // iso surface
2384 mgr->insert( action( VISU_CUT_PLANES ), -1, -1, -1 ); // cut planes
2385 mgr->insert( action( VISU_CUT_LINES ), -1, -1, -1 ); // cut lines
2386 mgr->insert( action( VISU_DEFORMED_SHAPE ), -1, -1, -1 ); // deformed shape
2387 mgr->insert( action( VISU_VECTORS ), -1, -1, -1 ); // vectors
2388 mgr->insert( action( VISU_STREAM_LINES ), -1, -1, -1 ); // stream lines
2389 mgr->insert( action( VISU_PLOT_3D ), -1, -1, -1 ); // Plot3d
2391 mgr->insert( action( VISU_CREATE_PRS ), -1, -1, -1 ); // create presentation
2392 mgr->insert( action( VISU_CREATE_MANY_PRS ), -1, -1, -1 ); // create presentations
2394 mgr->insert( action( VISU_CREATE_TABLE ), -1, -1, -1 ); // create table
2397 mgr->insert( action( VISU_EDIT_SCALARMAP ), -1, -1, -1 );
2398 mgr->insert( action( VISU_EDIT_DEFORMEDSHAPE ), -1, -1, -1 );
2399 mgr->insert( action( VISU_EDIT_CUTPLANES ), -1, -1, -1 );
2400 mgr->insert( action( VISU_EDIT_CUTLINES ), -1, -1, -1 );
2401 mgr->insert( action( VISU_EDIT_ISOSURFACE ), -1, -1, -1 );
2402 mgr->insert( action( VISU_EDIT_VECTORS ), -1, -1, -1 );
2403 mgr->insert( action( VISU_EDIT_STREAMLINES ), -1, -1, -1 );
2404 mgr->insert( action( VISU_EDIT_PLOT3D ), -1, -1, -1 );
2405 mgr->insert( action( VISU_EDIT_CONTAINER ), -1, -1, -1 );
2408 mgr->insert( action( VISU_RENAME ), -1, -1, -1 );
2411 mgr->insert( action( VISU_COPY_PRS ), -1, -1, -1 );
2414 mgr->insert( action( VISU_CLEAR_CONTAINER ), -1, -1, -1 );
2417 //mgr->insert( action( VISU_SHOW_TABLE ), -1, -1, -1 ); // show table
2418 //mgr->insert( action( VISU_CREATE_CURVES ), -1, -1, -1 ); // create curves
2419 //mgr->insert( action( VISU_EXPORT_TABLE ), -1, -1, -1 ); // export table
2421 mgr->insert( separator(), -1, -1, -1 );
2423 mgr->insert( action( VISU_ERASE ), -1, -1, -1 ); // erase
2424 mgr->insert( action( VISU_DISPLAY ), -1, -1, -1 ); // display
2425 mgr->insert( action( VISU_DISPLAY_ONLY ), -1, -1, -1 ); // display only
2427 // "Representation" submenu
2428 int parentId = mgr->insert( tr( "MEN_REPRESENTATION" ), -1, -1 );
2429 mgr->insert( action( VISU_POINTS ) , parentId, -1, -1 ); // points
2430 mgr->insert( action( VISU_WIREFRAME ) , parentId, -1, -1 ); // wireframe
2431 mgr->insert( action( VISU_SURFACE ) , parentId, -1, -1 ); // surface
2432 mgr->insert( action( VISU_INSIDEFRAME ) , parentId, -1, -1 ); // insideframe
2433 mgr->insert( action( VISU_SURFACEFRAME ), parentId, -1, -1 ); // surfaceframe
2434 mgr->insert( action( VISU_SHRINK ) , parentId, -1, -1 ); // shrink
2435 mgr->insert( action( VISU_UNSHRINK ) , parentId, -1, -1 ); // unshrink
2436 mgr->insert( separator(), parentId, -1, -1 );
2437 mgr->insert( action( VISU_SHADING ) , parentId, -1, -1 ); // shading
2438 mgr->insert( action( VISU_NOSHADING ) , parentId, -1, -1 ); // noshading
2440 // "Properties" submenu
2441 parentId = mgr->insert( tr( "MEN_PROPERTIES" ), -1, -1 );
2442 mgr->insert( action( VISU_CELL_COLOR ), parentId, -1, -1 ); // cell color
2443 mgr->insert( action( VISU_EDGE_COLOR ), parentId, -1, -1 ); // edge color
2444 mgr->insert( action( VISU_COLOR ) , parentId, -1, -1 ); // color
2445 mgr->insert( action( VISU_OPACITY ) , parentId, -1, -1 ); // opacity
2446 mgr->insert( action( VISU_LINE_WIDTH ), parentId, -1, -1 ); // line width
2448 mgr->insert( separator(), -1, -1, -1 );
2450 // Other presentations management
2451 mgr->insert( action( VISU_TRANSLATE_PRS ), -1, -1, -1 );
2452 mgr->insert( action( VISU_CLIPPING ), -1, -1, -1 );
2454 mgr->insert( action( VISU_MERGE_SCALAR_BARS ), -1, -1, -1 );
2455 mgr->insert( action( VISU_FREE_SCALAR_BARS ), -1, -1, -1 );
2457 mgr->insert( action( VISU_SWEEP ), -1, -1, -1 );
2458 mgr->insert( action( VISU_ANIMATION ), -1, -1, -1 );
2460 mgr->insert( separator(), -1, -1, -1 );
2462 // view parameters commands
2463 mgr->insert( action( VISU_SAVE_VIEW_PARAMS ), -1, -1, -1 ); // save view params
2464 mgr->insert( action( VISU_SAVE_VIEW_PARAMS_1 ), -1, -1, -1 ); // save view params
2465 mgr->insert( action( VISU_RESTORE_VIEW_PARAMS ), -1, -1, -1 ); // restore view params
2466 //mgr->insert( action( VISU_DELETE_VIEW_PARAMS ), -1, -1, -1 ); // delete view params
2468 mgr->insert( action( VISU_ARRANGE_ACTORS ), -1, -1, -1 ); // arrange actors
2470 mgr->insert( action( VISU_CURVE_PROPS ), -1, -1, -1 ); // curve properties
2472 mgr->insert( action( VISU_SELECTION_INFO ), -1, -1, -1 ); // Selection info
2476 QString aPrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
2477 "'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D'");
2479 // VISU root commands
2480 QString aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TVISUGEN'";
2481 mgr->setRule( action( VISU_IMPORT_FROM_FILE ), aRule, true );
2482 mgr->setRule( action( VISU_IMPORT_TABLE ), aRule, true );
2483 mgr->setRule( action( VISU_PLOT2D ), aRule, true );
2485 // timestamp commands
2486 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TTIMESTAMP'";
2487 mgr->setRule( action( VISU_SCALAR_MAP ), aRule, true );
2488 mgr->setRule( action( VISU_ISO_SURFACES ), aRule, true );
2489 mgr->setRule( action( VISU_CUT_PLANES ), aRule, true );
2490 mgr->setRule( action( VISU_CUT_LINES ), aRule, true );
2491 mgr->setRule( action( VISU_PLOT_3D ), aRule, true );
2492 aRule += " and nbComponents>1";
2493 mgr->setRule( action( VISU_DEFORMED_SHAPE ), aRule, true );
2494 mgr->setRule( action( VISU_VECTORS ), aRule, true );
2495 mgr->setRule( action( VISU_STREAM_LINES ), aRule, true );
2497 // display/erase commands
2498 QString andInvisible = " and (((not isVisible) and isActiveView) or (not isActiveView))";
2499 QString aTableOrCont = "(type='VISU::TTABLE' and nbChildren>0) or type='VISU::TCONTAINER'";
2500 QString orCurveVisible = "or (type='VISU::TCURVE' and isVisible)";
2501 QString orCurveInvisible = "or (type='VISU::TCURVE'" + andInvisible + ")";
2502 QString aPrsVisible = "(($type in {'VISU::TMESH' " + aPrsAll + "}) and isVisible)";
2503 QString aPrsInvisible = "(($type in {'VISU::TMESH' " + aPrsAll + "})" + andInvisible + ")";
2504 QString aComponent = "( selcount=1 and canBeDisplayed )";
2506 QString anEraseRule = "( selcount>0 and ({true} in $canBeDisplayed) and (" + aPrsVisible +
2507 " or (client='ObjectBrowser' and (" + aTableOrCont + orCurveVisible + "))) ) or " + aComponent;
2509 QString aDisplayRule = "( selcount>0 and ({true} in $canBeDisplayed) and (" + aPrsInvisible +
2510 " or (client='ObjectBrowser' and (" + aTableOrCont + orCurveInvisible + "))) ) or" + aComponent;
2512 QString aDOnlyRule = "( selcount>0 and ({true} in $canBeDisplayed) and (($type in {'VISU::TMESH' " + aPrsAll + "})"
2513 " or (client='ObjectBrowser' and ((type='VISU::TTABLE' and nbChildren>0) or"
2514 " ($type in {'VISU::TCURVE' 'VISU::TCONTAINER'})))) ) or" + aComponent;
2516 mgr->setRule( action( VISU_ERASE ), anEraseRule, true );
2517 mgr->setRule( action( VISU_DISPLAY ), aDisplayRule, true );
2518 mgr->setRule( action( VISU_DISPLAY_ONLY ), aDOnlyRule, true );
2520 aRule = "selcount>0 and $type in {'VISU::TMESH' " + aPrsAll + "}";
2521 mgr->setRule( action( VISU_TRANSLATE_PRS ), aRule, true );
2523 aRule = "selcount>1 and $type in {'VISU::TMESH' " + aPrsAll + "}";
2524 mgr->setRule( action( VISU_MERGE_SCALAR_BARS ), aRule, true );
2525 mgr->setRule( action( VISU_FREE_SCALAR_BARS ), aRule, true );
2528 aRule = "selcount=1 and type='VISU::TVIEW3D'";
2529 mgr->setRule( action( VISU_SAVE_VIEW_PARAMS_1 ), aRule, true );
2530 mgr->setRule( action( VISU_SAVE_VIEW_PARAMS ), "client='VTKViewer' and selcount=0", true );
2531 mgr->setRule( action( VISU_RESTORE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D'", true );
2532 //mgr->setRule( action( VISU_DELETE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D'", true );
2534 mgr->setRule( action( VISU_ARRANGE_ACTORS ), "client='VTKViewer' and selcount=0", true );
2536 // 3D presentations commands
2537 QString aPrsType = " and $type in {'VISU::TMESH' " + aPrsAll + "}";
2538 QString aInsideType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE'}";
2539 QString aSurfType = " and $type in {'VISU::TMESH'}";
2540 QString aShrinkType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' "
2541 "'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TPLOT3D'}";
2542 QString aLineType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
2543 "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D'}";
2545 aRule = "selcount=1";
2546 mgr->setRule( action( VISU_CLIPPING ), aRule + aPrsType, true );
2548 // "Representation" submenu
2549 QString aNotPoints = " and $representation in {'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}";
2550 QString aNotWirefr = " and $representation in {'VISU::POINT' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}";
2551 QString aNotSurfac = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}";
2552 QString aNotInside = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::SURFACEFRAME'}";
2553 QString aNotSurffr = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}";
2555 mgr->setRule( action( VISU_POINTS ) , aRule + aPrsType + aNotPoints, true );
2556 mgr->setRule( action( VISU_WIREFRAME ) , aRule + aPrsType + aNotWirefr, true );
2557 mgr->setRule( action( VISU_SURFACE ) , aRule + aPrsType + aNotSurfac, true );
2558 mgr->setRule( action( VISU_INSIDEFRAME ) , aRule + aInsideType + aNotInside, true );
2559 mgr->setRule( action( VISU_SURFACEFRAME ), aRule + aSurfType + aNotSurffr, true );
2561 mgr->setRule( action( VISU_SHRINK ) , aRule + aShrinkType + " and isShrunk=0", true );
2562 mgr->setRule( action( VISU_UNSHRINK ), aRule + aShrinkType + " and isShrunk=1", true );
2564 mgr->setRule( action( VISU_SHADING ) , aRule + " and isScalarMapAct=1 and isShading=0", true );
2565 mgr->setRule( action( VISU_NOSHADING ), aRule + " and isScalarMapAct=1 and isShading=1", true );
2567 // "Properties" submenu
2568 mgr->setRule( action( VISU_CELL_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'", true );
2569 mgr->setRule( action( VISU_EDGE_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'", true );
2570 mgr->setRule( action( VISU_COLOR ), aRule + " and ((type='VISU::TMESH'"
2571 " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}) "
2572 "or (type='VISU::TDEFORMEDSHAPE' and hasActor=1))", true );
2573 mgr->setRule( action( VISU_OPACITY ), aRule + aShrinkType + " and hasActor=1", true );
2574 mgr->setRule( action( VISU_LINE_WIDTH ), aRule + aLineType + " and hasActor=1", true );
2577 QString aCurveAll = "'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER'";
2579 aRule = "selcount=1 and ($type in {'VISU::TVIEW3D' 'VISU::TMESH' " + aCurveAll + " " + aPrsAll + "})";
2580 mgr->setRule( action( VISU_RENAME ), aRule, true );
2582 // copy presentation command
2583 aRule = "selcount=1 and ($type in {" + aPrsAll + "})";
2584 mgr->setRule( action( VISU_COPY_PRS ), aRule, true );
2587 aRule = "selcount=1 and type='VISU::TCURVE'";
2588 mgr->setRule( action( VISU_CURVE_PROPS ), aRule, true );
2590 // curve container commands
2591 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TCONTAINER'";
2592 mgr->setRule( action( VISU_EDIT_CONTAINER ), aRule, true );
2593 mgr->setRule( action( VISU_CLEAR_CONTAINER ), aRule, true );
2595 mgr->setRule( action( VISU_EDIT_SCALARMAP ),
2596 "selcount=1 and type='VISU::TSCALARMAP'", true );
2597 mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPE ),
2598 "selcount=1 and type='VISU::TDEFORMEDSHAPE'", true );
2599 mgr->setRule( action( VISU_EDIT_CUTPLANES ),
2600 "selcount=1 and type='VISU::TCUTPLANES'", true );
2601 mgr->setRule( action( VISU_EDIT_CUTLINES ),
2602 "selcount=1 and type='VISU::TCUTLINES'", true );
2603 mgr->setRule( action( VISU_EDIT_ISOSURFACE ),
2604 "selcount=1 and type='VISU::TISOSURFACE'", true );
2605 mgr->setRule( action( VISU_EDIT_VECTORS ),
2606 "selcount=1 and type='VISU::TVECTORS'", true );
2607 mgr->setRule( action( VISU_EDIT_STREAMLINES ),
2608 "selcount=1 and type='VISU::TSTREAMLINES'", true );
2609 mgr->setRule( action( VISU_EDIT_PLOT3D ),
2610 "selcount=1 and type='VISU::TPLOT3D'", true );
2612 aRule = "selcount=1 and type='VISU::TCUTLINES' and nbNamedChildren=0";
2613 mgr->setRule( action( VISU_CREATE_TABLE ), aRule, true );
2615 aRule = "selcount=1 and ($type in {" + aPrsAll + "})";
2616 mgr->setRule( action( VISU_SWEEP ), aRule, true );
2618 // "Selection info" popup item
2619 aRule = "client='VTKViewer' and selcount=1" + aInsideType;
2620 mgr->setRule( action( VISU_SELECTION_INFO ), aRule, true );
2622 aRule = "client='ObjectBrowser' and selcount>0 and $type in {'VISU::TFIELD'} and nbTimeStamps>1";
2623 mgr->setRule( action( VISU_ANIMATION ), aRule, true );
2625 aRule = "client='ObjectBrowser' and $type in {'VISU::TENTITY' 'VISU::TFAMILY' 'VISU::TGROUP'}";
2626 mgr->setRule( action( VISU_CREATE_PRS ), aRule + " and selcount=1", true );
2627 mgr->setRule( action( VISU_CREATE_MANY_PRS ), aRule + " and selcount>1", true );
2629 //aRule = "client='ObjectBrowser' and type='MEDFIELD'";
2630 //mgr->setRule( action( VISU_IMPORT_MED ), aRule, true );
2633 //***************************************************************************
2634 void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, QString& theTitle )
2636 SalomeApp_Module::contextMenuPopup(theClient, theMenu, theTitle);
2638 OB_Browser* ob = getApp()->objectBrowser();
2639 bool isOBClient = (ob && theClient == ob->popupClientType());
2641 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2642 SALOME_ListIO aListIO;
2643 aSelectionMgr->selectedObjects(aListIO);
2645 if (aListIO.Extent() < 1) return;
2647 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2649 // Check if "Merge Scalar Range" can be applied
2651 SALOME_ListIteratorOfListIO It (aListIO);
2652 for (; It.More(); It.Next()) {
2653 Handle(SALOME_InteractiveObject)& anIO = It.Value();
2655 if (!anIO.IsNull() && anIO->hasEntry()) {
2656 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
2657 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSObject);
2658 if (CORBA::is_nil(aCORBAObject)) {
2659 _PTR(GenericAttribute) anAttr;
2660 if (aSObject->FindAttribute(anAttr, "AttributeComment")) {
2661 _PTR(AttributeComment) aComment (anAttr);
2662 string aComm = aComment->Value();
2663 QString strIn (aComm.c_str());
2664 VISU::Storable::TRestoringMap pMap;
2665 VISU::Storable::StrToMap(strIn, pMap);
2667 VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(pMap,"myType",&isExist).toInt();
2668 if (isExist && aType == VISU::TTIMESTAMP) {
2669 _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(aSObject);
2671 for (; anIter->More(); anIter->Next()) {
2672 aPrs = anIter->Value();
2673 if (!aPrs) continue;
2674 std::vector<VISU::Prs3d_i*> aSubList = GetPrs3dList(this, aPrs);
2675 nbPrs += aSubList.size();
2684 theMenu->insertSeparator();
2685 action( VISU_MERGE_SCALAR_BARS )->addTo(theMenu);
2686 action( VISU_FREE_SCALAR_BARS )->addTo(theMenu);
2689 theMenu->insertSeparator();
2691 // Check if some (nb > 0) removable objects selected
2692 if (isOBClient && IsRemovableSelected(this)) {
2693 action( VISU_DELETE_OBJS )->addTo(theMenu);
2696 // Check if some curves selected (for bug PAL10611)
2697 bool isCurves = false;
2698 SALOME_ListIteratorOfListIO It1 (aListIO);
2699 for (; It1.More() && !isCurves; It1.Next()) {
2700 Handle(SALOME_InteractiveObject)& anIO = It1.Value();
2702 if (!anIO.IsNull() && anIO->hasEntry()) {
2703 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
2704 _PTR(GenericAttribute) anAttr;
2705 if (aSObject->FindAttribute(anAttr, "AttributeComment")) {
2706 _PTR(AttributeComment) aComment (anAttr);
2707 string aComm = aComment->Value();
2708 QString strIn (aComm.c_str());
2709 VISU::Storable::TRestoringMap pMap;
2710 VISU::Storable::StrToMap(strIn, pMap);
2712 VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(pMap,"myType",&isExist).toInt();
2713 if (isExist && aType == VISU::TCURVE) {
2720 action( myDisplay )->removeFrom(theMenu);
2721 action( myErase )->removeFrom(theMenu);
2722 action( myDisplayOnly )->removeFrom(theMenu);
2723 action( myEraseAll )->removeFrom(theMenu);
2726 // Check single selection
2727 if (aListIO.Extent() != 1) return;
2729 Handle(SALOME_InteractiveObject) anIO;
2730 VISU::Storable::TRestoringMap aMap;
2731 CORBA::Object_var anObject = GetSelectedObj( this, &anIO, &aMap);
2733 _PTR(SObject) SO = aCStudy->FindObjectID(anIO->getEntry());
2735 VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
2737 if (aType == VISU::TANIMATION) {
2738 action( VISU_SHOW_ANIMATION )->addTo(theMenu);
2740 } else if (isOBClient) {
2741 if (IsSObjectTable(SO)) {
2742 action( VISU_SHOW_TABLE )->addTo(theMenu);
2743 action( VISU_CREATE_CURVES )->addTo(theMenu);
2744 action( VISU_EXPORT_TABLE )->addTo(theMenu);
2745 theMenu->insertSeparator();
2747 if (!CORBA::is_nil(anObject)) {
2748 SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
2749 if (!CORBA::is_nil(aMED.in())) {
2750 action( VISU_IMPORT_MED_STRUCTURE )->addTo(theMenu);
2753 SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject); // "Import Structure"
2754 if (!CORBA::is_nil(aField)) {
2755 action( VISU_IMPORT_MED_TIMESTAMP )->addTo(theMenu); // "Import TimeStamp"
2758 _PTR(SObject) aSFather = SO->GetFather();
2760 _PTR(GenericAttribute) anAttr;
2761 aSFather->FindAttribute(anAttr, "AttributeName");
2763 _PTR(AttributeName) aName (anAttr);
2764 std::string aValue = aName->Value();
2765 if (strcmp(aValue.c_str(), "MEDFIELD") == 0) {
2766 action( VISU_IMPORT_MED_FIELD )->addTo(theMenu); // "Import Field"
2776 //***************************************************************************
2779 windows( QMap<int, int>& theMap ) const
2782 theMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::DockLeft );
2783 theMap.insert( SalomeApp_Application::WT_PyConsole, Qt::DockBottom );
2789 viewManagers( QStringList& theList ) const
2792 theList.append( SVTK_Viewer::Type() );
2800 CORBA::String_var anIOR = GetVisuGen(this)->GetID();
2801 return QString(anIOR.in());
2807 activateModule( SUIT_Study* theStudy )
2809 SalomeApp_Module::activateModule( theStudy );
2811 setMenuShown( true );
2812 setToolShown( true );
2819 deactivateModule( SUIT_Study* theStudy )
2821 setMenuShown( false );
2822 setToolShown( false );
2824 SalomeApp_Module::deactivateModule( theStudy );
2830 createSelection() const
2832 return new VisuGUI_Selection( (SalomeApp_Module*)this );
2835 //******************************************************************
2836 void VisuGUI::studyActivated()
2838 GetVisuGen(this)->SetCurrentStudy(GetDSStudy(GetCStudy(GetAppStudy(this))));
2846 return new VisuGUI();
2851 void VisuGUI::createPreferences()
2853 // TAB: "Scalar Bar"
2854 int sbarTab = addPreference( tr( "VISU_SCALAR_BAR" ) );
2857 int fontGr = addPreference( tr( "VISU_FONT" ), sbarTab );
2858 int tfont = addPreference( tr( "VISU_TITLE" ), fontGr,
2859 LightApp_Preferences::Font, "VISU", "scalar_bar_title_font" );
2860 addPreference( tr( "VISU_TITLE" ), fontGr,
2861 LightApp_Preferences::Color, "VISU", "scalar_bar_title_color" );
2862 int lfont = addPreference( tr( "VISU_LABELS" ), fontGr,
2863 LightApp_Preferences::Font, "VISU", "scalar_bar_label_font" );
2864 addPreference( tr( "VISU_LABELS" ), fontGr,
2865 LightApp_Preferences::Color, "VISU", "scalar_bar_label_color" );
2868 fam.append( tr( "VISU_FONT_ARIAL" ) );
2869 fam.append( tr( "VISU_FONT_COURIER" ) );
2870 fam.append( tr( "VISU_FONT_TIMES" ) );
2871 int wflag = ( QtxListResourceEdit::FontItem::All &
2872 ( ~( QtxListResourceEdit::FontItem::Size |
2873 QtxListResourceEdit::FontItem::UserSize ) ) );
2875 setPreferenceProperty( tfont, "families", fam );
2876 setPreferenceProperty( tfont, "system", false );
2877 setPreferenceProperty( tfont, "widget_flags", wflag );
2878 setPreferenceProperty( lfont, "families", fam );
2879 setPreferenceProperty( lfont, "system", false );
2880 setPreferenceProperty( lfont, "widget_flags", wflag );
2882 // group: "Colors & Labels"
2883 int colorsLabelsGr = addPreference( tr( "VISU_COLORS_AND_LABELS" ), sbarTab );
2885 int numcol = addPreference( tr( "VISU_NB_COLORS" ), colorsLabelsGr,
2886 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_num_colors" );
2887 setPreferenceProperty( numcol, "min", 2 );
2888 setPreferenceProperty( numcol, "max", 64 );
2890 int numlab = addPreference( tr( "VISU_NB_LABELS" ), colorsLabelsGr,
2891 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_num_labels" );
2892 setPreferenceProperty( numlab, "min", 2 );
2893 setPreferenceProperty( numlab, "max", 65 );
2895 // group: "Orientation"
2896 int orientGr = addPreference( tr( "VISU_ORIENTATION" ), sbarTab );
2897 int orient = addPreference( tr( "VISU_ORIENTATION" ), orientGr,
2898 LightApp_Preferences::Selector, "VISU", "scalar_bar_orientation" );
2899 QStringList orients;
2900 orients.append( tr( "VISU_VERTICAL" ) );
2901 orients.append( tr( "VISU_HORIZONTAL" ) );
2902 QValueList<QVariant> indices;
2903 indices.append( 0 );
2904 indices.append( 1 );
2905 setPreferenceProperty( orient, "strings", orients );
2906 setPreferenceProperty( orient, "indexes", indices );
2908 // group: "Origin & Size Vertical"
2909 int posVSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_VERTICAL" ), sbarTab );
2910 int xv = addPreference( tr( "VISU_X" ), posVSizeGr,
2911 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_x" );
2912 int yv = addPreference( tr( "VISU_Y" ), posVSizeGr,
2913 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_y" );
2914 int wv = addPreference( tr( "VISU_WIDTH" ), posVSizeGr,
2915 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_width" );
2916 int hv = addPreference( tr( "VISU_HEIGHT" ), posVSizeGr,
2917 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_height" );
2918 setPreferenceProperty( xv, "step", 0.1 );
2919 setPreferenceProperty( yv, "step", 0.1 );
2920 setPreferenceProperty( wv, "step", 0.1 );
2921 setPreferenceProperty( hv, "step", 0.1 );
2922 setPreferenceProperty( xv, "min", 0.0 );
2923 setPreferenceProperty( yv, "min", 0.0 );
2924 setPreferenceProperty( wv, "min", 0.0 );
2925 setPreferenceProperty( hv, "min", 0.0 );
2926 setPreferenceProperty( xv, "max", 1.0 );
2927 setPreferenceProperty( yv, "max", 1.0 );
2928 setPreferenceProperty( wv, "max", 1.0 );
2929 setPreferenceProperty( hv, "max", 1.0 );
2931 // group: "Origin & Size Horizontal"
2932 int posHSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_HORIZONTAL" ), sbarTab );
2933 int xh = addPreference( tr( "VISU_X" ), posHSizeGr,
2934 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_x" );
2935 int yh = addPreference( tr( "VISU_Y" ), posHSizeGr,
2936 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_y" );
2937 int wh = addPreference( tr( "VISU_WIDTH" ), posHSizeGr,
2938 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_width" );
2939 int hh = addPreference( tr( "VISU_HEIGHT" ), posHSizeGr,
2940 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_height" );
2941 setPreferenceProperty( xh, "step", 0.1 );
2942 setPreferenceProperty( yh, "step", 0.1 );
2943 setPreferenceProperty( wh, "step", 0.1 );
2944 setPreferenceProperty( hh, "step", 0.1 );
2945 setPreferenceProperty( xh, "min", 0.0 );
2946 setPreferenceProperty( yh, "min", 0.0 );
2947 setPreferenceProperty( wh, "min", 0.0 );
2948 setPreferenceProperty( hh, "min", 0.0 );
2949 setPreferenceProperty( xh, "max", 1.0 );
2950 setPreferenceProperty( yh, "max", 1.0 );
2951 setPreferenceProperty( wh, "max", 1.0 );
2952 setPreferenceProperty( hh, "max", 1.0 );
2954 // group: "Scalar bars default position"
2955 int scalarBarGr = addPreference( tr( "Scalar bars default position" ), sbarTab );
2956 addPreference( tr( "Arrange Scalar Bars" ), scalarBarGr,
2957 LightApp_Preferences::Bool, "VISU", "scalar_bars_default_position" );
2959 // TAB: "Scalar range, Sweep, MED import, Shading"
2960 int srangeTab = addPreference( tr( "VISU_PREF_SECOND_TAB" ) );
2962 // group: "Scalar range"
2963 int rangeGr = addPreference( tr( "VISU_SCALAR_RANGE" ), srangeTab );
2964 setPreferenceProperty( rangeGr, "columns", 1 );
2966 int mode = addPreference( tr( "VISU_SCALAR_MODE" ), rangeGr,
2967 LightApp_Preferences::Selector, "VISU", "scalar_bar_mode" );
2969 modes.append( tr( "VISU_MODULUS" ) );
2970 modes.append( tr( "VISU_COMPONENT" ) + tr("1") );
2971 modes.append( tr( "VISU_COMPONENT" ) + tr("2") );
2972 modes.append( tr( "VISU_COMPONENT" ) + tr("3") );
2974 indices.append( 0 );
2975 indices.append( 1 );
2976 indices.append( 2 );
2977 indices.append( 3 );
2978 setPreferenceProperty( mode, "strings", modes );
2979 setPreferenceProperty( mode, "indexes", indices );
2981 addPreference( tr( "VISU_LOGARITHMIC_SCALING" ), rangeGr,
2982 LightApp_Preferences::Bool, "VISU", "scalar_bar_logarithmic" );
2984 int rangetype = addPreference( tr( "VISU_RANGE_TO_USE" ), rangeGr,
2985 LightApp_Preferences::Selector, "VISU", "scalar_range_type" );
2987 types.append( tr( "VISU_FIELD_RANGE" ) );
2988 types.append( tr( "VISU_IMPOSED_RANGE" ) );
2990 indices.append( 0 );
2991 indices.append( 1 );
2992 setPreferenceProperty( rangetype, "strings", types );
2993 setPreferenceProperty( rangetype, "indexes", indices );
2995 // group: "Min and max for imposed range"
2996 int imposedGr = addPreference( tr( "VISU_MINMAX_IMPOSED_RANGE" ), srangeTab );
2998 int min = addPreference( tr( "VISU_MIN" ), imposedGr,
2999 LightApp_Preferences::DblSpin, "VISU", "scalar_range_min" );
3000 int max = addPreference( tr( "VISU_MAX" ), imposedGr,
3001 LightApp_Preferences::DblSpin, "VISU", "scalar_range_max" );
3002 setPreferenceProperty( min, "step", 0.1 );
3003 setPreferenceProperty( max, "step", 0.1 );
3005 // group: "Sweeping preferences"
3006 int sweepGr = addPreference( tr( "VISU_SWEEPING_PREF" ), srangeTab );
3007 setPreferenceProperty( sweepGr, "columns", 1 );
3009 int timestep = addPreference( tr( "VISU_TIME_STEP" ), sweepGr,
3010 LightApp_Preferences::DblSpin, "VISU", "sweeping_time_step" );
3011 int nbcycles = addPreference( tr( "VISU_NB_CYCLES" ), sweepGr,
3012 LightApp_Preferences::IntSpin, "VISU", "sweeping_number_cycles" );
3013 int nbsteps = addPreference( tr( "VISU_NB_STEPS" ), sweepGr,
3014 LightApp_Preferences::IntSpin, "VISU", "sweeping_number_steps" );
3015 setPreferenceProperty( timestep, "min", 0.1 );
3016 setPreferenceProperty( timestep, "step", 0.1 );
3017 setPreferenceProperty( timestep, "max", 1000 );
3018 setPreferenceProperty( nbcycles, "max", 100 );
3019 setPreferenceProperty( nbsteps, "max", 200 );
3021 // group: "MED files import"
3022 int importGr = addPreference( tr( "VISU_PREF_MED_IMPORT" ), srangeTab );
3023 addPreference( tr( "VISU_PREF_MED_FULL_LOAD" ), importGr,
3024 LightApp_Preferences::Bool, "VISU", "full_med_loading" );
3026 // group: "Representation properties"
3027 int representGr = addPreference( tr( "VISU_PREF_REPRESENT_PROPS" ), srangeTab );
3028 addPreference( tr( "VISU_PREF_SHADING" ), representGr,
3029 LightApp_Preferences::Bool, "VISU", "represent_shading" );
3032 void VisuGUI::preferencesChanged( const QString&, const QString& )
3038 ::getViewManager(const QString& theType,
3039 const bool theIsCreate)
3041 return getApp()->getViewManager(theType,theIsCreate);
3046 ::getScalarBarsMap()
3048 return myScalarBarsMap;
3050 LightApp_Displayer* VisuGUI::displayer()
3053 myDisplayer = new VisuGUI_Displayer( getApp() );