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.salome-platform.org/ or email : webmaster.salome@opencascade.com
38 #include <qptrvector.h>
39 #include <qcolordialog.h>
40 #include <qdatetime.h>
43 #include <vtkRenderer.h>
44 #include <vtkRenderWindow.h>
45 #include <vtkActorCollection.h>
46 #include <vtkTimerLog.h>
49 #include "SALOME_LifeCycleCORBA.hxx"
51 #include "SUIT_ResourceMgr.h"
52 #include "SUIT_MessageBox.h"
54 #include "SUIT_ViewWindow.h"
55 #include "SUIT_ViewManager.h"
57 #include "CAM_Module.h"
59 #include "SVTK_ViewWindow.h"
60 #include "SVTK_ViewModel.h"
61 #include "SVTK_Functor.h"
63 #include "SPlot2d_ViewModel.h"
64 #include "VisuGUI_SetupPlot2dDlg.h"
65 #include "Plot2d_SetupCurveDlg.h"
66 #include "Plot2d_ViewManager.h"
68 #include "OB_Browser.h"
70 #include "SALOME_ListIO.hxx"
71 #include "SALOME_ListIteratorOfListIO.hxx"
73 #include "SalomeApp_Application.h"
74 #include "SalomeApp_DataModel.h"
75 #include "SalomeApp_Study.h"
76 #include "SalomeApp_CheckFileDlg.h"
77 #include "LightApp_SelectionMgr.h"
78 #include "LightApp_Selection.h"
79 #include "LightApp_Preferences.h"
81 #include "QtxAction.h"
83 #include "VISUConfig.hh"
84 #include "VISU_Gen_i.hh"
85 #include "VISU_Mesh_i.hh"
86 #include "VISU_Table_i.hh"
87 #include "VISU_Result_i.hh"
88 #include "VISU_View_i.hh"
89 #include "VISU_ViewManager_i.hh"
90 #include "VISU_Plot3D_i.hh"
92 #include "VISU_Actor.h"
94 #include "VisuGUI_Prs3dTools.h"
95 #include "VisuGUI_Tools.h"
97 #include "VisuGUI_PopupTools.h"
98 #include "VisuGUI_NameDlg.h"
99 #include "VisuGUI_CursorDlg.h"
100 #include "VisuGUI_Selection.h"
101 #include "VisuGUI_TimeAnimation.h"
102 #include "VisuGUI_EditContainerDlg.h"
103 #include "VisuGUI_ClippingDlg.h"
104 #include "VisuGUI_Plot3DDlg.h"
105 #include "VisuGUI_OffsetDlg.h"
106 #include "VisuGUI_Displayer.h"
107 #include "VisuGUI_BuildProgressDlg.h"
108 #include "VisuGUI_TransparencyDlg.h"
110 #include "VISU_ScalarMap_i.hh"
111 #include "VisuGUI_ScalarBarDlg.h"
113 #include "VISU_DeformedShape_i.hh"
114 #include "VisuGUI_DeformedShapeDlg.h"
116 #include "VISU_ScalarMapOnDeformedShape_i.hh"
117 #include "VisuGUI_ScalarMapOnDeformedShapeDlg.h"
119 #include "VISU_IsoSurfaces_i.hh"
120 #include "VisuGUI_IsoSurfacesDlg.h"
122 #include "VISU_CutPlanes_i.hh"
123 #include "VisuGUI_CutPlanesDlg.h"
125 #include "VISU_CutLines_i.hh"
126 #include "VisuGUI_CutLinesDlg.h"
128 #include "VISU_StreamLines_i.hh"
129 #include "VisuGUI_StreamLinesDlg.h"
131 #include "VISU_Vectors_i.hh"
132 #include "VisuGUI_VectorsDlg.h"
134 #include "VisuGUI_TableDlg.h"
136 #include "SALOMEconfig.h"
137 #include CORBA_SERVER_HEADER(MED_Gen)
139 #include "utilities.h"
141 #include "VisuGUI_ActionsDef.h"
143 #include "VisuGUI_Timer.h"
145 #include "VVTK_ViewModel.h"
147 using namespace VISU;
150 static int MYDEBUG = 1;
152 static int MYDEBUG = 0;
155 //////////////////////////////////////////////////
157 //////////////////////////////////////////////////
160 SalomeApp_Module( "VISU" ),
174 if(MYDEBUG) MESSAGE("VisuGUI::OnImportFromFile()");
175 if ( CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)) )
178 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
182 aFilter.append( tr( "FLT_MED_FILES" ) );
183 aFilter.append( tr( "FLT_ALL_FILES" ) );
185 bool toUseBuildProgress = aResourceMgr->booleanValue("VISU", "use_build_progress", false);
187 SalomeApp_CheckFileDlg* fd = new SalomeApp_CheckFileDlg( GetDesktop(this), true, tr("USE_BUILD_PROGRESS") );
188 fd->setCaption( tr( "IMPORT_FROM_FILE" ) );
189 fd->setFilters( aFilter );
190 fd->SetChecked( toUseBuildProgress );
192 QFileInfo aFileInfo( fd->selectedFile() );
193 toUseBuildProgress = fd->IsChecked();
196 // Check the file name
197 if ( !aFileInfo.exists() )
200 if ( !toUseBuildProgress )
202 bool toBuildFields = aResourceMgr->booleanValue( "VISU", "build_fields", true );
203 bool toBuildMinMax = aResourceMgr->booleanValue( "VISU", "build_min_max", true );
204 bool toBuildGroups = aResourceMgr->booleanValue( "VISU", "build_groups", true );
205 bool toBuildAll = aResourceMgr->booleanValue( "VISU", "full_med_loading", false );
206 bool toBuildAtOnce = aResourceMgr->booleanValue( "VISU", "build_at_once", false );
208 QString anInfo("Importing From File " + aFileInfo.filePath() + "..." );
209 application()->putInfo( anInfo );
211 QApplication::setOverrideCursor(Qt::waitCursor);
212 VISU::Result_var aResult = GetVisuGen(this)->CreateResult( aFileInfo.filePath() );
214 if (CORBA::is_nil(aResult.in())) {
215 SUIT_MessageBox::warn1(GetDesktop(this),
217 VisuGUI_BuildProgressDlg::tr("ERR_ERROR_IN_THE_FILE"),
219 QApplication::restoreOverrideCursor();
221 aResult->SetBuildFields( toBuildFields, toBuildMinMax );
222 aResult->SetBuildGroups( toBuildGroups );
223 aResult->Build( toBuildAll, toBuildAtOnce );
225 UpdateObjBrowser(this);
226 application()->putInfo( anInfo + tr("INF_DONE"));
227 QApplication::restoreOverrideCursor();
232 VisuGUI_BuildProgressDlg* aBuildProgressDlg = new VisuGUI_BuildProgressDlg( GetDesktop(this) );
233 aBuildProgressDlg->setFileName( aFileInfo.filePath() );
234 aBuildProgressDlg->setGenerator( GetVisuGen(this) );
235 aBuildProgressDlg->show();
241 OnImportTableFromFile()
243 if(MYDEBUG) MESSAGE("VisuGUI::OnImportTableFromFile()");
244 if ( CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)) )
248 aFilter.append( tr("FLT_TABLE_FILES") );
249 aFilter.append( tr("FLT_ALL_FILES") );
251 QFileInfo aFileInfo =
252 SUIT_FileDlg::getFileName(GetDesktop(this),
255 tr("MEN_IMPORT_TABLE"),
257 if (aFileInfo.exists()) {
258 application()->putInfo( tr("MEN_IMPORT_TABLE") + " " + aFileInfo.filePath() + " ..." );
260 CORBA::Object_var anObject = GetVisuGen(this)->ImportTables(aFileInfo.filePath());
262 if (CORBA::is_nil(anObject.in())) {
263 SUIT_MessageBox::warn1(GetDesktop(this),
265 tr("ERR_ERROR_IN_THE_FILE"),
268 application()->putInfo(aFileInfo.filePath()+tr("INF_DONE"));
269 UpdateObjBrowser(this);
276 OnExportTableToFile()
278 if(MYDEBUG) MESSAGE("VisuGUI::OnExportTableToFile()");
280 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
282 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
283 SALOME_ListIO aListIO;
284 aSelectionMgr->selectedObjects(aListIO);
286 if (aListIO.Extent() > 0) {
287 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
288 if (anIO->hasEntry()) {
289 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
292 // find table attribute
294 _PTR(GenericAttribute) anAttr;
296 if (!aSObj->FindAttribute(anAttr, "AttributeTableOfReal")) {
298 if (!aSObj->FindAttribute(anAttr, "AttributeTableOfInteger")) {
299 // if the current SObject is a table title
300 // we take a father contaning the table
301 aSObj = aSObj->GetFather();
303 if (aSObj->FindAttribute(anAttr, "AttributeTableOfReal")) {
306 if (!aSObj->FindAttribute(anAttr, "AttributeTableOfInteger")) {
313 // get table title in order to have default name of the file
316 _PTR(AttributeTableOfReal) aTabAttr (anAttr);
317 if (!aTabAttr) return;
318 aTitle = aTabAttr->GetTitle().c_str();
320 _PTR(AttributeTableOfInteger) aTabAttr (anAttr);
321 if (!aTabAttr) return;
322 aTitle = aTabAttr->GetTitle().c_str();
324 aTitle.simplifyWhiteSpace();
325 aTitle = aTitle.replace(QRegExp(" "), "_").replace(QRegExp("\\*"), "" );
327 // get default path for the file
328 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
329 QString aDir = aResourceMgr->stringValue("VISU","OutputDir","");
330 if (aDir.isEmpty()) {
331 aDir = aResourceMgr->stringValue("VISU","InputDir","");
332 if (aDir.isEmpty()) {
333 aDir = getenv("CSF_PATHData");
336 QString aPath = Qtx::addSlash(aDir) + aTitle;
338 // get name for the file
340 aFilter.append("Table Files (*.xls)");
342 QFileInfo aFileInfo =
343 SUIT_FileDlg::getFileName(GetDesktop(this),
346 tr("MEN_EXPORT_TABLE"), // "Export Table To File"
350 QString aFile = aFileInfo.filePath();
351 if (!aFile.isEmpty()) {
352 application()->putInfo(tr("MEN_EXPORT_TABLE") + " " + aFile + " ...");
353 aDir = Qtx::dir(aFile, true);
354 aResourceMgr->setValue("VISU", "OutputDir", aDir);
357 GetVisuGen(this)->ExportTableToFile(GetSObject(aSObj), aFile.latin1());
358 application()->putInfo(aFile + " " + tr("INF_DONE"));
359 } catch(std::exception& exc) {
361 SUIT_MessageBox::warn1(GetDesktop(this),
363 tr("ERR_ERROR_DURING_EXPORT") + " " + tr(exc.what()),
366 INFOS(tr("ERR_ERROR_DURING_EXPORT"));
367 SUIT_MessageBox::warn1(GetDesktop(this),
369 tr("ERR_ERROR_DURING_EXPORT"),
381 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
382 if (CheckLock(aCStudy,GetDesktop(this)))
384 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
386 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
387 SALOME_ListIO aListIO;
388 aSelectionMgr->selectedObjects(aListIO);
390 SALOME_ListIteratorOfListIO It (aListIO);
391 QApplication::setOverrideCursor(Qt::waitCursor);
392 for (; It.More(); It.Next()) {
393 Handle(SALOME_InteractiveObject) anIO = It.Value();
394 SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
395 if (!aSObject->_is_nil()) {
396 CORBA::Object_var anObject = VISU::SObjectToObject(aSObject);
397 if (!CORBA::is_nil(anObject)) {
398 SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
399 if (!CORBA::is_nil(aMED.in()))
400 GetVisuGen(this)->ImportMed(aSObject);
401 SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject);
402 if (!CORBA::is_nil(aField.in()))
403 GetVisuGen(this)->ImportMedField(aField);
405 SALOMEDS::SObject_var aSFather = aSObject->GetFather();
406 SALOMEDS::GenericAttribute_var anAttr;
407 aSFather->FindAttribute(anAttr, "AttributeName");
408 SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
409 CORBA::String_var aValue = aName->Value();
410 if (strcmp(aValue.in(), "MEDFIELD") == 0)
411 GetVisuGen(this)->ImportMed(aSObject);
415 UpdateObjBrowser(this, true);
416 QApplication::restoreOverrideCursor();
420 CreateCurves( SalomeApp_Module* theModule,
421 VISU::CutLines_i* thePrs,
423 const bool theCreate = true )
427 VisuGUI_CutLinesDlg* aCutDlg = dynamic_cast<VisuGUI_CutLinesDlg*>( theDlg );
431 _PTR(Study) aStudy = GetCStudy( GetAppStudy( theModule ) );
432 _PTR(SObject) aSObject = aStudy->FindObjectID( thePrs->GetEntry().latin1() );
434 if ( !theCreate && aSObject ) {
436 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
437 _PTR(ChildIterator) aIter = aStudy->NewChildIterator(aSObject);
438 for (; aIter->More(); aIter->Next()) {
439 _PTR(SObject) aTblObj = aIter->Value();
441 _PTR(GenericAttribute) anAttr;
442 if (aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
444 _PTR(ChildIterator) aChildIter = aStudy->NewChildIterator( aTblObj );
445 SalomeApp_Study* salome_study = GetAppStudy( theModule );
446 for( aChildIter->InitEx( false ); aChildIter->More(); aChildIter->Next() ){
447 salome_study->deleteReferencesTo( aChildIter->Value() );
448 _PTR(SObject) aSO = aChildIter->Value();
450 if (getValue(aSO, "myComment") == QString("CURVE")) {
451 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSO);
452 if(!CORBA::is_nil(aCORBAObject)){
453 PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
454 VISU::Curve_i* pCrv = dynamic_cast<VISU::Curve_i*>(aServant.in());
456 PlotRemoveCurve(theModule,pCrv);
464 aBuilder->RemoveObjectWithChildren( aTblObj ); // We should have only one child
466 //UpdateObjBrowser(theModule,true,aTblObj);
473 if ( aCutDlg->isGenerateTable() ) {
474 GetVisuGen( theModule )->CreateTable( thePrs->GetEntry() );
475 if ( aCutDlg->isGenerateCurves() ) {
477 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
478 _PTR(ChildIterator) aIter = aStudy->NewChildIterator(aSObject);
479 for (; aIter->More(); aIter->Next()) {
480 _PTR(SObject) aTblObj = aIter->Value();
482 _PTR(GenericAttribute) anAttr;
483 if ( aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
484 CreatePlot( theModule, aTblObj );
492 if (!theCreate && aSObject) {
493 UpdateObjBrowser(theModule);
501 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
502 if (CheckLock(aStudy,GetDesktop(this)))
505 // Get selected SObject
506 Handle(SALOME_InteractiveObject) anIO;
507 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
508 if (anIO.IsNull() || !anIO->hasEntry())
511 // create a VTK view window if it does not exist
512 SVTK_ViewWindow* aViewWindow = GetViewWindow<SVTK_Viewer>(this);
514 // create mesh presentation and display it in aViewWindow
515 CreateMesh(this, anIO, aViewWindow);
522 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
523 if (CheckLock(aStudy,GetDesktop(this)))
526 // create a VTK view window if it does not exist
527 SVTK_ViewWindow* aViewWindow = GetViewWindow<SVTK_Viewer>(this);
529 // Get selected SObject
530 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
531 SALOME_ListIO aListIO;
532 aSelectionMgr->selectedObjects(aListIO);
533 SALOME_ListIteratorOfListIO anIter (aListIO);
534 for (; anIter.More(); anIter.Next()) {
535 Handle(SALOME_InteractiveObject) anIO = anIter.Value();
536 if (anIO.IsNull() || !anIO->hasEntry())
539 // create mesh presentation and display it in aViewWindow
540 CreateMesh(this, anIO, aViewWindow);
548 CreatePrs3d<VISU::ScalarMap_i,VisuGUI_ScalarBarDlg,1>(this);
554 OnCreateDeformedShape()
556 CreatePrs3d<VISU::DeformedShape_i,VisuGUI_DeformedShapeDlg,1>(this);
561 OnCreateScalarMapOnDeformedShape()
563 CreatePrs3d<VISU::ScalarMapOnDeformedShape_i,VisuGUI_ScalarMapOnDeformedShapeDlg,1>(this);
570 CreatePrs3d<VISU::Vectors_i,VisuGUI_VectorsDlg,1>(this);
575 OnCreateIsoSurfaces()
577 CreatePrs3d<VISU::IsoSurfaces_i,VisuGUI_IsoSurfacesDlg,1>(this);
584 CreatePrs3d<VISU::CutPlanes_i,VisuGUI_CutPlanesDlg,0>(this);
591 CreatePrs3d<VISU::CutLines_i,VisuGUI_CutLinesDlg,0>(this);
596 OnCreateStreamLines()
598 CreatePrs3d<VISU::StreamLines_i,VisuGUI_StreamLinesDlg,1>(this);
605 CreatePrs3d<VISU::Plot3D_i,VisuGUI_Plot3DDlg,0>(this);
612 CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this));
613 GetVisuGen( this )->CreateContainer();
614 UpdateObjBrowser(this);
621 if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs");
623 LightApp_SelectionMgr* mgr = GetSelectionMgr(this);
626 QApplication::setOverrideCursor(Qt::waitCursor);
628 SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this);
630 SALOME_ListIO aSel, aList;
631 mgr->selectedObjects(aSel);
632 extractContainers(aSel, aList);
634 for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
635 Handle(SALOME_InteractiveObject) anIO = it.Value();
636 CORBA::Object_var anObject = GetSelectedObj(GetAppStudy(this), anIO->getEntry());
638 if (!CORBA::is_nil(anObject)) {
639 // is it Prs3d object ?
640 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
642 if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs : Prs3d object");
643 //UpdateViewer( this, aPrsObject );
645 displayer()->Display(anIO->getEntry());
646 vw->highlight(anIO, 1);
651 VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(anObject).in());
653 if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs : Curve object");
654 //PlotCurve( this, aCurve, VISU::eDisplay );
655 displayer()->Display(anIO->getEntry());
659 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(anObject).in());
661 if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Container object");
662 //PlotContainer( this, aContainer, VISU::eDisplay );
663 displayer()->Display(anIO->getEntry());
667 VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(anObject).in());
669 if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Table object");
670 //PlotTable( this, aTable, VISU::eDisplay );
671 displayer()->Display(anIO->getEntry());
678 vw->getRenderer()->ResetCameraClippingRange();
682 QApplication::restoreOverrideCursor();
697 if(MYDEBUG) MESSAGE("OnErasePrs");
699 QApplication::setOverrideCursor(Qt::waitCursor);
701 //SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this);
703 // vw->unHighlightAll();
705 SALOME_ListIO aList, aSel;
706 LightApp_SelectionMgr* mgr = GetSelectionMgr(this);
707 mgr->selectedObjects(aSel);
708 extractContainers(aSel, aList);
710 for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
711 Handle(SALOME_InteractiveObject) anIO = it.Value();
712 CORBA::Object_var anObject = GetSelectedObj(GetAppStudy(this), anIO->getEntry());
713 //ErasePrs(this, anObject, /*repaint_view_window = */false);
714 ErasePrs(this, anObject, /*repaint_view_window = */true);
720 QApplication::restoreOverrideCursor();
727 startOperation( myEraseAll );
728 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
729 vw->unHighlightAll();
730 if (vtkRenderer *aRen = vw->getRenderer()) {
732 vtkActorCollection *anActColl = aRen->GetActors();
733 for (anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ) {
734 if (anActor->GetVisibility() > 0)
735 if (VISU_Actor* anVISUActor = VISU_Actor::SafeDownCast(anActor)) {
736 RemoveScalarBarPosition(this, vw, anVISUActor->GetPrs3d());
737 anVISUActor->VisibilityOff();
742 } else if (SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(this, false)) {
752 Handle(SALOME_InteractiveObject) anIO;
753 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
754 EditPrs3d<VISU::ScalarMap_i, VisuGUI_ScalarBarDlg, 1>(this, anIO, aPrs3d);
759 OnEditDeformedShape()
761 Handle(SALOME_InteractiveObject) anIO;
762 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
763 EditPrs3d<VISU::DeformedShape_i, VisuGUI_DeformedShapeDlg, 1>(this, anIO, aPrs3d);
768 OnEditScalarMapOnDeformedShape()
770 Handle(SALOME_InteractiveObject) anIO;
771 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
772 EditPrs3d<VISU::ScalarMapOnDeformedShape_i, VisuGUI_ScalarMapOnDeformedShapeDlg, 1>(this, anIO, aPrs3d);
779 Handle(SALOME_InteractiveObject) anIO;
780 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
781 EditPrs3d<VISU::CutPlanes_i, VisuGUI_CutPlanesDlg, 0>(this, anIO, aPrs3d);
788 Handle(SALOME_InteractiveObject) anIO;
789 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
790 EditPrs3d<VISU::CutLines_i, VisuGUI_CutLinesDlg, 0>(this, anIO, aPrs3d);
797 Handle(SALOME_InteractiveObject) anIO;
798 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
799 EditPrs3d<VISU::IsoSurfaces_i, VisuGUI_IsoSurfacesDlg, 1>(this, anIO, aPrs3d);
806 Handle(SALOME_InteractiveObject) anIO;
807 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
808 EditPrs3d<VISU::Vectors_i, VisuGUI_VectorsDlg, 1>(this, anIO, aPrs3d);
815 Handle(SALOME_InteractiveObject) anIO;
816 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
817 EditPrs3d<VISU::StreamLines_i, VisuGUI_StreamLinesDlg, 1>(this, anIO, aPrs3d);
824 Handle(SALOME_InteractiveObject) anIO;
825 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
826 EditPrs3d<VISU::Plot3D_i, VisuGUI_Plot3DDlg, 0>(this, anIO, aPrs3d);
834 ChangeRepresentation(this, VISU::SURFACEFRAME);
841 ChangeRepresentation(this, VISU::INSIDEFRAME);
848 ChangeRepresentation(this, VISU::WIREFRAME);
855 ChangeRepresentation(this, VISU::SHADED);
862 ChangeRepresentation(this, VISU::POINT);
869 ChangeRepresentation(this, VISU::SHRINK);
876 SetShading(this, true);
883 SetShading(this, false);
890 Handle(SALOME_InteractiveObject) anIO;
891 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
892 if (CORBA::is_nil(anObject)) return;
893 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
894 if (!aServant.in()) return;
896 VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
899 SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this);
902 VISU_Actor* anActor = GetActor(aPrs3d, vw);
903 if (!anActor) return;
905 VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
906 VISU::DeformedShape_i* aDeformedShape = dynamic_cast<VISU::DeformedShape_i*>(aPrs3d);
907 SALOMEDS::Color anOldColor, aNewColor;
908 int aRepresent = anActor->GetRepresentation();
910 switch (aRepresent) {
912 anOldColor = aMesh->GetNodeColor();
914 case VISU::WIREFRAME :
915 case VISU::INSIDEFRAME :
916 anOldColor = aMesh->GetLinkColor();
919 case VISU::SURFACEFRAME :
920 anOldColor = aMesh->GetCellColor();
923 } else if (aDeformedShape) {
924 anOldColor = aDeformedShape->GetColor();
929 QColor aColor (int(255*anOldColor.R),
930 int(255*anOldColor.G),
931 int(255*anOldColor.B));
932 QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
933 if (aColorNew.isValid()) {
934 aNewColor.R = aColorNew.red()/255.;
935 aNewColor.G = aColorNew.green()/255.;
936 aNewColor.B = aColorNew.blue()/255.;
938 switch (aRepresent) {
940 aMesh->SetNodeColor(aNewColor);
942 case VISU::WIREFRAME :
943 case VISU::INSIDEFRAME :
944 aMesh->SetLinkColor(aNewColor);
947 case VISU::SURFACEFRAME :
948 aMesh->SetCellColor(aNewColor);
952 aDeformedShape->SetColor(aNewColor);
954 RecreateActor(this, aPrs3d);
960 OnChangeWireframeColor()
962 Handle(SALOME_InteractiveObject) anIO;
963 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
964 if (CORBA::is_nil(anObject)) return;
965 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
966 if (!aServant.in()) return;
968 VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
971 SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this);
974 VISU_Actor* anActor = GetActor(aPrs3d, vw);
975 if (!anActor) return;
977 if (VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d)) {
978 SALOMEDS::Color anOldColor = aMesh->GetLinkColor(), aNewColor;
979 QColor aColor (int(255*anOldColor.R),
980 int(255*anOldColor.G),
981 int(255*anOldColor.B));
982 QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
983 if (aColorNew.isValid()) {
984 aNewColor.R = aColorNew.red()/255.;
985 aNewColor.G = aColorNew.green()/255.;
986 aNewColor.B = aColorNew.blue()/255.;
987 aMesh->SetLinkColor(aNewColor);
988 RecreateActor(this, aMesh);
997 Handle(SALOME_InteractiveObject) anIO;
998 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
999 if (CORBA::is_nil(anObject)) return;
1000 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1001 if (!aServant.in()) return;
1003 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
1004 if (!aPrsObject) return;
1006 SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this);
1009 VISU_Actor* anActor = GetActor(aPrsObject, vw);
1010 if (!anActor) return;
1012 VisuGUI_TransparencyDlg* aTransparencyDlg = new VisuGUI_TransparencyDlg( this );
1013 aTransparencyDlg->show();
1020 Handle(SALOME_InteractiveObject) anIO;
1021 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1022 if (CORBA::is_nil(anObject)) return;
1023 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1024 if (!aServant.in()) return;
1026 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
1027 if (!aPrsObject) return;
1029 SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this);
1032 VISU_Actor* anActor = GetActor(aPrsObject, vw);
1033 if (!anActor) return;
1035 VisuGUI_CursorDlg* CursorDlg =
1036 new VisuGUI_CursorDlg (GetDesktop(this), tr("DLG_LINEWIDTH_TITLE"), TRUE);
1038 CursorDlg->Comment1->setText(tr("DLG_LINEWIDTH_CMT1"));
1039 CursorDlg->Comment2->setText(tr("DLG_LINEWIDTH_CMT2"));
1040 CursorDlg->SpinBox1->setMinValue(1);
1041 CursorDlg->SpinBox1->setMaxValue(10);
1043 float oldlwid = anActor->GetLineWidth();
1044 int intlwid = int(oldlwid);
1045 CursorDlg->SpinBox1->setValue(intlwid);
1047 int ret = CursorDlg->exec();
1049 intlwid = CursorDlg->SpinBox1->value();
1050 float newlwid = intlwid;
1051 anActor->SetLineWidth(newlwid);
1060 Handle(SALOME_InteractiveObject) anIO;
1061 CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
1063 if ( !CORBA::is_nil( anObject ) ) {
1064 VISU::Base_var aVisuObj = VISU::Base::_narrow( anObject );
1065 if ( !CORBA::is_nil( aVisuObj ) && aVisuObj->GetType() == VISU::TTABLE ) {
1066 CORBA::Object_ptr aTable = VISU::Table::_narrow( anObject );
1067 if( !CORBA::is_nil( aTable ) ) {
1068 VISU::Table_i* table = dynamic_cast<VISU::Table_i*>( VISU::GetServant(aTable).in() );
1070 SO = GetCStudy( GetAppStudy( this ) )->FindObjectID( table->GetObjectEntry() );
1075 // possibly this is Table SObject
1076 SO = GetCStudy( GetAppStudy( this ) )->FindObjectID( anIO->getEntry() );
1079 if( !IsSObjectTable( SO ) )
1082 VisuGUI_TableDlg* dlg = new VisuGUI_TableDlg( GetDesktop( this ),
1085 //SAL2670 Orientation of show tables
1086 VisuGUI_TableDlg::ttAuto,
1095 Handle(SALOME_InteractiveObject) anIO;
1096 CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
1097 _PTR(Study) aStudy = GetCStudy( GetAppStudy( this ) );
1098 _PTR(SObject) aSObject = aStudy->FindObjectID(anIO->getEntry());
1099 VISU::CutLines_var aCutLines = VISU::CutLines::_narrow( anObject );
1100 if(!aCutLines->_is_nil() || IsSObjectTable(aSObject)) {
1101 GetVisuGen( this )->CreateTable( aSObject->GetID().c_str() );
1102 UpdateObjBrowser(this);
1110 SalomeApp_Study* anAppStudy = GetAppStudy(this);
1111 _PTR(Study) aCStudy = GetCStudy(anAppStudy);
1112 if (CheckLock(aCStudy,GetDesktop(this)))
1115 SALOME_ListIO aList;
1116 LightApp_SelectionMgr* mgr = GetSelectionMgr(this);
1117 mgr->selectedObjects(aList,QString::null,false);
1118 int i = 0, nbSelected = aList.Extent();
1119 if (nbSelected < 1) return;
1121 const char* entries [nbSelected];
1122 Handle(SALOME_InteractiveObject) anIO;
1123 for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
1125 if (anIO->hasEntry())
1126 entries[i++] = anIO->getEntry();
1129 if (nbSelected < 1) return;
1131 // There is a transaction
1132 _PTR(StudyBuilder) aStudyBuilder = aCStudy->NewBuilder();
1133 aStudyBuilder->NewCommand();
1135 for (i = 0; i < nbSelected; i++) {
1136 _PTR(SObject) aSObject = aCStudy->FindObjectID(entries[i]);
1138 _PTR(SObject) aRefObj;
1139 if (aSObject->ReferencedObject(aRefObj)) {
1140 // It can be a reference on curve, published under a container.
1141 // In this case the curve should be removed from the container.
1143 CORBA::Object_var aCorbaObj = VISU::GetSelectedObj(anAppStudy, aRefObj->GetID().c_str());
1144 if (!CORBA::is_nil(aCorbaObj)) {
1145 VISU::Base_var aVisuObj = VISU::Base::_narrow(aCorbaObj);
1146 if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TMESH)
1148 DeleteSObject(this, aCStudy, aRefObj);
1149 UpdateObjBrowser(this, true, aRefObj);
1151 else if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TCURVE) {
1152 VISU::Curve_ptr aCurve = VISU::Curve::_narrow(aVisuObj);
1153 _PTR(SObject) aParentSO = aSObject->GetFather();
1154 aCorbaObj = VISU::GetSelectedObj(anAppStudy, aParentSO->GetID().c_str());
1155 if (!CORBA::is_nil(aCorbaObj) && !CORBA::is_nil(aCurve)) {
1156 aVisuObj = VISU::Base::_narrow(aCorbaObj);
1157 if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TCONTAINER) {
1159 CORBA::Object_ptr aCnt = VISU::Container::_narrow(aVisuObj);
1160 if (!CORBA::is_nil(aCnt)) {
1161 VISU::Container_i* aContainer =
1162 dynamic_cast<VISU::Container_i*>(VISU::GetServant(aCnt).in());
1163 if (aContainer && aContainer->GetNbCurves() > 0) {
1164 aContainer->RemoveCurve(aCurve);
1165 UpdateObjBrowser(this, true, aParentSO);
1173 DeleteSObject(this, aCStudy, aSObject);
1174 UpdateObjBrowser(this, true, aSObject);
1179 // Finish transaction
1180 aStudyBuilder->CommitCommand();
1181 mgr->clearSelected();
1188 Handle(SALOME_InteractiveObject) anIO;
1189 CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
1191 _PTR(GenericAttribute) anAttr;
1192 _PTR(AttributeName) aName;
1194 _PTR(Study) aStudy = GetCStudy( GetAppStudy( this ) );
1196 if ( !CORBA::is_nil( anObject ) ) {
1197 VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
1198 if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TTABLE) {
1199 // Table (VISU object) is selected
1200 CORBA::Object_ptr aTbl = VISU::Table::_narrow( anObject );
1201 if( !CORBA::is_nil( aTbl ) ) {
1202 VISU::Table_i* table = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTbl).in());
1204 _PTR(SObject) SO = aStudy->FindObjectID( table->GetObjectEntry() );
1205 if ( IsSObjectTable(SO) ) {
1206 // get name of SObject
1207 if ( SO->FindAttribute( anAttr, "AttributeName" ) ) {
1209 SOName = QString( aName->Value().c_str() );
1211 VisuGUI_SetupPlot2dDlg* dlg = new VisuGUI_SetupPlot2dDlg( SO, GetDesktop( this ) );
1212 if ( dlg->exec() == QDialog::Accepted ) {
1213 if ( !IsStudyLocked( aStudy ) ) {
1214 // if study is not locked - create new container, create curves and insert them
1215 // into container, then plot container if current viewer is of VIEW_PLOT2D type
1217 QValueList<int> verIndices;
1218 dlg->getCurvesSource( horIndex, verIndices );
1219 if ( horIndex >= 0 && verIndices.count() > 0 ) {
1220 CORBA::Object_var aContainer = GetVisuGen(this)->CreateContainer();
1221 if( !CORBA::is_nil( aContainer ) ) {
1222 VISU::Container_i* pContainer =
1223 dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
1225 for ( int i = 0; i < verIndices.count(); i++ ) {
1226 CORBA::Object_var aNewCurve =
1227 GetVisuGen(this)->CreateCurve( table->_this(), horIndex+1, verIndices[i]+1 );
1228 if( !CORBA::is_nil( aNewCurve ) ) {
1229 VISU::Curve_i* pCrv =
1230 dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aNewCurve).in());
1233 int marker, line, lineWidth;
1235 if ( dlg->getCurveAttributes(verIndices[i], isAuto, marker,
1236 line, lineWidth, color) && !isAuto ) {
1238 c.R = color.red() /255.;
1239 c.G = color.green()/255.;
1240 c.B = color.blue() /255.;
1241 pCrv->SetColor( c );
1242 pCrv->SetMarker( ( VISU::Curve::MarkerType )marker );
1243 pCrv->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1245 pContainer->AddCurve( pCrv->_this() );
1249 UpdateObjBrowser(this);
1250 PlotContainer( this, pContainer, VISU::eDisplay );
1256 // if study is locked just get curves info and plot them
1257 // if current viewer is of VIEW_PLOT2D type
1258 QPtrList<Plot2d_Curve> container;
1259 dlg->getCurves( container );
1260 if ( !container.isEmpty() ) {
1261 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
1262 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( SOName );
1272 else if ( !anIO.IsNull() ) {
1273 // check if Table SObject is selected
1274 SO = aStudy->FindObjectID( anIO->getEntry() );
1275 if ( IsSObjectTable(SO) ) {
1276 // get name of SObject
1277 if ( SO->FindAttribute( anAttr, "AttributeName" ) ) {
1279 SOName = QString( aName->Value().c_str() );
1281 VisuGUI_SetupPlot2dDlg* dlg = new VisuGUI_SetupPlot2dDlg( SO, GetDesktop( this ) );
1282 if ( dlg->exec() == QDialog::Accepted ) {
1283 if ( !IsStudyLocked( aStudy ) ) {
1284 // if study is not locked - create new table and container objects, create curves
1285 // and insert them into container, then plot container if current viewer is of VIEW_PLOT2D type
1287 QValueList<int> verIndices;
1288 dlg->getCurvesSource( horIndex, verIndices );
1289 if ( horIndex >= 0 && verIndices.count() > 0 ) {
1290 CORBA::Object_var aTable = GetVisuGen(this)->CreateTable( SO->GetID().c_str() );
1291 CORBA::Object_var aContainer = GetVisuGen(this)->CreateContainer();
1292 if ( !CORBA::is_nil( aTable ) && !CORBA::is_nil( aContainer ) ) {
1293 VISU::Table_i* pTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTable).in());
1294 VISU::Container_i* pContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
1296 if ( pContainer && pTable ) {
1297 for ( int i = 0; i < verIndices.count(); i++ ) {
1298 CORBA::Object_var aNewCurve = GetVisuGen(this)->CreateCurve
1299 ( pTable->_this(), horIndex+1, verIndices[i]+1 );
1300 if( !CORBA::is_nil( aNewCurve ) ) {
1301 VISU::Curve_i* pCrv = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aNewCurve).in());
1304 int marker, line, lineWidth;
1306 if ( dlg->getCurveAttributes(verIndices[i], isAuto, marker,
1307 line, lineWidth, color) && !isAuto ) {
1309 c.R = color.red()/255.;
1310 c.G = color.green()/255.;
1311 c.B = color.blue()/255.;
1312 pCrv->SetColor( c );
1313 pCrv->SetMarker( ( VISU::Curve::MarkerType )marker );
1314 pCrv->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1316 pContainer->AddCurve( pCrv->_this() );
1320 UpdateObjBrowser(this);
1321 PlotContainer( this, pContainer, VISU::eDisplay );
1326 // if study is locked just get curves info and plot them
1327 QPtrList<Plot2d_Curve> container;
1328 dlg->getCurves( container );
1329 if ( !container.isEmpty() ) {
1330 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
1331 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( SOName );
1344 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1345 SALOME_ListIO aListIO;
1346 aSelectionMgr->selectedObjects(aListIO);
1347 if (aListIO.Extent() != 1) return;
1349 SalomeApp_Study* aAppStudy = GetAppStudy(this);
1350 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1351 CORBA::Object_var anObject = GetSelectedObj( aAppStudy, anIO->getEntry() );
1352 if (CORBA::is_nil( anObject )) return;
1354 VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
1355 if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TCURVE) {
1357 CORBA::Object_ptr aCurve = VISU::Curve::_narrow( anObject );
1358 if( !CORBA::is_nil( aCurve ) ) {
1359 VISU::Curve_i* aDSCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
1360 if ( aDSCurve && (!IsStudyLocked( GetCStudy(aAppStudy) )) ) {
1361 Plot2d_SetupCurveDlg aDlg(GetDesktop( this ));
1363 aDlg.setLine( (int)aDSCurve->GetLine(), aDSCurve->GetLineWidth() );
1364 aDlg.setMarker( (int)aDSCurve->GetMarker() );
1365 SALOMEDS::Color aColor = aDSCurve->GetColor();
1366 aDlg.setColor( QColor( (int)(aColor.R*255.), (int)(aColor.G*255.), (int)(aColor.B*255.) ) );
1367 if( aDlg.exec() == QDialog::Accepted ) {
1368 aDSCurve->SetLine( (VISU::Curve::LineType)aDlg.getLine(), aDlg.getLineWidth() );
1369 aDSCurve->SetMarker( (VISU::Curve::MarkerType)aDlg.getMarker());
1370 SALOMEDS::Color newColor;
1371 newColor.R = aDlg.getColor().red()/255.;
1372 newColor.G = aDlg.getColor().green()/255.;
1373 newColor.B = aDlg.getColor().blue()/255.;
1374 aDSCurve->SetColor( newColor );
1375 PlotCurve(this, aDSCurve, VISU::eDisplay);
1386 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1387 if (CheckLock(aCStudy,GetDesktop(this)))
1389 Handle(SALOME_InteractiveObject) anIO;
1390 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1391 if (anIO.IsNull() || CORBA::is_nil(anObject))
1394 VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
1395 if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TCONTAINER) {
1397 CORBA::Object_ptr aCnt = VISU::Container::_narrow(anObject);
1398 if (!CORBA::is_nil(aCnt)) {
1399 VISU::Container_i* container = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aCnt).in());
1400 if (container && container->GetNbCurves() > 0) {
1402 UpdateObjBrowser(this);
1412 Handle(SALOME_InteractiveObject) anIO;
1413 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1414 if (CORBA::is_nil(anObject)) return;
1416 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1417 if (!aServant.in()) return;
1418 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aServant.in());
1419 if (!aContainer) return;
1421 VisuGUI_EditContainerDlg* aDlg = new VisuGUI_EditContainerDlg (this);
1422 aDlg->initFromPrsObject(aContainer);
1424 aDlg->storeToPrsObject(aContainer);
1425 UpdateObjBrowser(this, true);
1434 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1435 if (CheckLock(aCStudy,GetDesktop(this)))
1438 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
1439 if (aViewMgr->getType() != SVTK_Viewer::Type())
1442 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1443 SALOME_ListIO aListIO;
1444 aSelectionMgr->selectedObjects(aListIO);
1445 if (aListIO.Extent() > 1)
1448 if (aListIO.Extent() == 0) {
1449 VISU::View3D_i::SaveViewParams(aViewMgr, VISU::View3D_i::GenerateViewParamsName().latin1());
1451 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1452 VISU::View3D_i::SaveViewParams(aViewMgr, anIO->getName());
1454 UpdateObjBrowser(this);
1459 OnRestoreViewParams()
1461 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
1462 if (aViewMgr->getType() != SVTK_Viewer::Type())
1465 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1466 SALOME_ListIO aListIO;
1467 aSelectionMgr->selectedObjects(aListIO);
1468 if (aListIO.Extent() != 1)
1471 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1472 //jfa tmp:VISU::View3D_i::RestoreViewParams(aViewMgr, anIO->getName());
1473 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));//jfa tmp
1474 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());//jfa tmp
1476 VISU::View3D_i::RestoreViewParams(aViewMgr, aSObj->GetName().c_str());//jfa tmp
1483 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1484 if (CheckLock(aCStudy,GetDesktop(this)))
1487 Handle(SALOME_InteractiveObject) anIO;
1488 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1490 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
1493 //TEST DU PARENT == VISU
1494 _PTR(StudyBuilder) aBuilder = aCStudy->NewBuilder();
1495 _PTR(GenericAttribute) anAttr = aBuilder->FindOrCreateAttribute(aSObj, "AttributeName");
1497 _PTR(AttributeName) aName (anAttr);
1498 QString Name = VisuGUI_NameDlg::getName( GetDesktop( this ), aName->Value().c_str() );
1499 if (!Name.isEmpty()) {
1500 QApplication::setOverrideCursor(Qt::waitCursor);
1502 // rename specific objects
1503 if (!CORBA::is_nil(anObject)) {
1504 VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
1505 if (!CORBA::is_nil(aVisuObj)) {
1506 switch (aVisuObj->GetType()) {
1507 case VISU::TCURVE: // Curve object
1509 CORBA::Object_ptr aCurve = VISU::Curve::_narrow(anObject);
1510 if (!CORBA::is_nil(aCurve)) {
1511 VISU::Curve_i* curve =
1512 dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
1514 curve->SetName(Name.latin1());
1518 case VISU::TTABLE: // Table object
1520 CORBA::Object_ptr aTable = VISU::Table::_narrow(anObject);
1521 if (!CORBA::is_nil(aTable)) {
1522 VISU::Table_i* table =
1523 dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTable).in());
1525 table->SetName(Name.latin1());
1529 case VISU::TCONTAINER: // Container object
1531 CORBA::Object_ptr aContainer = VISU::Container::_narrow(anObject);
1532 if (!CORBA::is_nil(aContainer)) {
1533 VISU::Container_i* container =
1534 dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
1536 container->SetName(Name.latin1());
1547 // rename the study object
1548 aName->SetValue(Name.latin1()); // rename the SObject
1549 anIO->setName(Name.latin1()); // rename the InteractiveObject
1551 ViewManagerList pvm_list;
1552 getApp()->viewManagers( SPlot2d_Viewer::Type(), pvm_list );
1553 for( SUIT_ViewManager* mgr = pvm_list.first(); mgr; mgr = pvm_list.next() )
1555 Plot2d_ViewManager* pvm = dynamic_cast<Plot2d_ViewManager*>( mgr );
1558 SPlot2d_Viewer* pv = dynamic_cast<SPlot2d_Viewer*>( pvm->getViewModel() );
1560 pv->renameAll( anIO, Name.latin1() );
1564 UpdateObjBrowser(this, false);
1566 QApplication::restoreOverrideCursor();
1575 new VisuGUI_ClippingDlg (this, "", false);
1583 Handle(SALOME_InteractiveObject) anIO;
1584 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1585 if (CORBA::is_nil(anObject)) return;
1586 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1587 if (!aServant.in()) return;
1589 VISU::ScalarMap_i* aPrsObject = dynamic_cast<VISU::ScalarMap_i*>(aServant.in());
1590 if (!aPrsObject) return;
1592 SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this);
1595 VISU_Actor* aActor = GetActor(aPrsObject, vw);
1596 if (!aActor) return;
1598 if (!aActor->GetVisibility()) {
1599 aActor->VisibilityOn();
1602 // Get sweep parameters
1603 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
1605 double aTempoDbl = aResourceMgr->doubleValue("VISU", "sweeping_time_step", 0.1);
1606 int aTemp = int(1.E6 * aTempoDbl);
1608 int aCycles = aResourceMgr->integerValue("VISU", "sweeping_number_cycles", 1);
1609 int aSteps = aResourceMgr->integerValue("VISU", "sweeping_time_step", 40);
1612 QApplication::setOverrideCursor(Qt::waitCursor);
1613 for (int j = 0; j < aCycles; j++) {
1614 for (int i = 0; i <= aSteps; i++) {
1616 float aPercents = float(i)/aSteps;
1617 aPrsObject->SetMapScale(aPercents);
1618 aPrsObject->UpdateActor(aActor);
1619 vw->getRenderWindow()->Render();
1621 } catch (std::exception& exc) {
1622 INFOS("Follow exception was occured :\n" << exc.what());
1624 INFOS("Unknown exception was occured!");
1628 QApplication::restoreOverrideCursor();
1635 if (!VISU::GetActiveViewWindow<SVTK_ViewWindow>(this))
1638 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1639 VisuGUI_TimeAnimationDlg* aAnimationDlg =
1640 new VisuGUI_TimeAnimationDlg (this, aCStudy);
1642 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1643 SALOME_ListIO aListIO;
1644 aSelectionMgr->selectedObjects(aListIO);
1646 bool isDefined = false;
1648 SALOME_ListIteratorOfListIO It (aListIO);
1649 for (; It.More(); It.Next()) {
1650 _PTR(SObject) aSObject = aCStudy->FindObjectID(It.Value()->getEntry());
1651 if (!aSObject) continue;
1652 if (getValue(aSObject, "myComment") == QString("FIELD")) {
1653 long aNumber = getValue(aSObject, "myNbTimeStamps").toLong();
1657 aAnimationDlg->addField(aSObject);
1659 } else if (aNbTimes == aNumber) {
1660 aAnimationDlg->addField(aSObject);
1665 if (isDefined) aAnimationDlg->show();
1666 else delete aAnimationDlg;
1669 //************************************************************************
1674 if (!VISU::GetActiveViewWindow<SVTK_ViewWindow>(this))
1677 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1678 SALOME_ListIO aListIO;
1679 aSelectionMgr->selectedObjects(aListIO);
1681 if (aListIO.Extent() != 1)
1684 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1686 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1688 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
1691 VISU::Storable::TRestoringMap aMap;
1692 _PTR(GenericAttribute) anAttr;
1693 if (!aSObj->FindAttribute(anAttr, "AttributeComment")) return;
1695 _PTR(AttributeComment) aComment (anAttr);
1696 string aComm = aComment->Value();
1697 QString strIn (aComm.c_str());
1698 VISU::Storable::StrToMap(strIn, aMap);
1700 VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
1701 if (aType != VISU::TANIMATION) return;
1703 VisuGUI_TimeAnimationDlg* aAnimationDlg =
1704 new VisuGUI_TimeAnimationDlg(this, aCStudy);
1705 aAnimationDlg->restoreFromStudy(aSObj);
1706 aAnimationDlg->show();
1711 OnCopyPresentation()
1713 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1714 if (CheckLock(aCStudy,GetDesktop(this)))
1717 Handle(SALOME_InteractiveObject) anIO;
1718 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1719 if (CORBA::is_nil(anObject)) return;
1720 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1721 if (!aServant.in()) return;
1723 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
1724 if (!aPrsObject) return;
1726 switch (aPrsObject->GetType()) {
1729 VISU::Mesh_i* aMeshPrs = dynamic_cast<VISU::Mesh_i*>(aPrsObject);
1730 VISU::Mesh_i* aSameMesh = new VISU::Mesh_i(aMeshPrs->GetResult());
1731 aSameMesh->SameAs(aMeshPrs);
1734 case VISU::TSCALARMAP:
1736 VISU::ScalarMap_i* aScalarPrs = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
1737 VISU::ScalarMap_i* aSameScalar = new VISU::ScalarMap_i(aScalarPrs->GetResult(),true);
1738 aSameScalar->SameAs(aScalarPrs);
1741 case VISU::TDEFORMEDSHAPE:
1743 VISU::DeformedShape_i* aDefPrs = dynamic_cast<VISU::DeformedShape_i*>(aPrsObject);
1744 VISU::DeformedShape_i* aSameDeformed = new VISU::DeformedShape_i(aDefPrs->GetResult(),true);
1745 aSameDeformed->SameAs(aDefPrs);
1748 case VISU::TSCALARMAPONDEFORMEDSHAPE:
1750 VISU::ScalarMapOnDeformedShape_i* aDefPrs =
1751 dynamic_cast<VISU::ScalarMapOnDeformedShape_i*>(aPrsObject);
1752 VISU::ScalarMapOnDeformedShape_i* aSameScalarMapOnDeformed =
1753 new VISU::ScalarMapOnDeformedShape_i(aDefPrs->GetResult(),true);
1754 aSameScalarMapOnDeformed->SameAs(aDefPrs);
1757 case VISU::TCUTPLANES:
1759 VISU::CutPlanes_i* aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
1760 VISU::CutPlanes_i* aSameCut = new VISU::CutPlanes_i(aCutPrs->GetResult(),true);
1761 aSameCut->SameAs(aCutPrs);
1764 case VISU::TCUTLINES:
1766 VISU::CutLines_i* aCutPrs = dynamic_cast<VISU::CutLines_i*>(aPrsObject);
1767 VISU::CutLines_i* aSameCut = new VISU::CutLines_i(aCutPrs->GetResult(),true);
1768 aSameCut->SameAs(aCutPrs);
1771 case VISU::TISOSURFACE:
1773 VISU::IsoSurfaces_i* aIsoPrs = dynamic_cast<VISU::IsoSurfaces_i*>(aPrsObject);
1774 VISU::IsoSurfaces_i* aSameIso = new VISU::IsoSurfaces_i(aIsoPrs->GetResult(),true);
1775 aSameIso->SameAs(aIsoPrs);
1778 case VISU::TSTREAMLINES:
1780 VISU::StreamLines_i* aLinesPrs = dynamic_cast<VISU::StreamLines_i*>(aPrsObject);
1781 VISU::StreamLines_i* aSameLines = new VISU::StreamLines_i(aLinesPrs->GetResult(),true);
1782 aSameLines->SameAs(aLinesPrs);
1785 case VISU::TVECTORS:
1787 VISU::Vectors_i* aVectorsPrs = dynamic_cast<VISU::Vectors_i*>(aPrsObject);
1788 VISU::Vectors_i* aSameVectors = new VISU::Vectors_i(aVectorsPrs->GetResult(),true);
1789 aSameVectors->SameAs(aVectorsPrs);
1794 VISU::Plot3D_i* aPlot3DPrs = dynamic_cast<VISU::Plot3D_i*>(aPrsObject);
1795 VISU::Plot3D_i* aSamePlot3D = new VISU::Plot3D_i(aPlot3DPrs->GetResult());
1796 aSamePlot3D->SameAs(aPlot3DPrs);
1800 UpdateObjBrowser(this);
1807 if (GetActiveViewWindow<SVTK_ViewWindow>(this))
1808 (new VisuGUI_SelectionDlg(this))->show();
1810 SUIT_MessageBox::warn1(GetDesktop(this),
1812 tr("ERR_ACTIVATE_VIEW3D"),
1820 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1821 SALOME_ListIO aListIO;
1822 aSelectionMgr->selectedObjects(aListIO);
1824 SALOME_ListIteratorOfListIO It (aListIO);
1826 // first find the bounds
1827 double aMin, aMax; bool first = true;
1828 for (; It.More(); It.Next()) {
1829 Handle(SALOME_InteractiveObject)& anIO = It.Value();
1830 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
1831 if (!aPrsList.empty()) {
1832 for (int i = 0, n = aPrsList.size(); i < n; i++) {
1833 VISU::Prs3d_i* aPrsObject = aPrsList[i];
1835 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
1839 aMin = aScalar->GetMin(); aMax = aScalar->GetMax();
1841 if (aScalar->GetMin() < aMin) aMin = aScalar->GetMin();
1842 if (aScalar->GetMax() > aMax) aMax = aScalar->GetMax();
1850 // set the computed range to every selected ScalarMap
1851 bool update = false;
1852 for (It.Initialize(aListIO); It.More(); It.Next() ) {
1853 Handle(SALOME_InteractiveObject)& anIO = It.Value();
1854 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
1855 if (!aPrsList.empty()) {
1856 for (int i = 0, n = aPrsList.size(); i < n; i++) {
1857 VISU::Prs3d_i* aPrsObject = aPrsList[i];
1859 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
1861 aScalar->SetRange(aMin, aMax);
1862 RecreateActor(this, aScalar);
1870 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
1871 vw->getRenderer()->ResetCameraClippingRange();
1881 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1882 SALOME_ListIO aListIO;
1883 aSelectionMgr->selectedObjects(aListIO);
1885 SALOME_ListIteratorOfListIO It (aListIO);
1887 // restore the source range for every ScalarMap
1888 bool update = false;
1889 for (; It.More(); It.Next()) {
1890 Handle(SALOME_InteractiveObject)& anIO = It.Value();
1891 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
1892 if (!aPrsList.empty()) {
1893 for (int i = 0, n = aPrsList.size(); i < n; i++) {
1894 VISU::Prs3d_i* aPrsObject = aPrsList[i];
1896 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
1898 aScalar->SetSourceRange();
1899 RecreateActor(this, aScalar);
1907 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
1908 vw->getRenderer()->ResetCameraClippingRange();
1918 if(MYDEBUG) MESSAGE("VisuGUI::OnTranslatePrs");
1919 VisuGUI_OffsetDlg* aDlg = new VisuGUI_OffsetDlg (this);
1921 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1923 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1924 SALOME_ListIO aListIO;
1925 aSelectionMgr->selectedObjects(aListIO);
1927 SALOME_ListIteratorOfListIO It (aListIO);
1928 for (; It.More(); It.Next()) {
1929 Handle(SALOME_InteractiveObject)& anIO = It.Value();
1930 if (anIO->hasEntry()) {
1931 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
1933 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSObject);
1934 if (!CORBA::is_nil(aCORBAObject)) {
1935 PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
1936 if (VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in())) {
1937 aDlg->addPresentation(aPrsObject);
1943 if (aDlg->getPrsCount() > 0)
1953 SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this);
1955 ArrangeDlg* aDlg = new ArrangeDlg (GetDesktop(this), vw);
1964 initialize( CAM_Application* theApp )
1966 SalomeApp_Module::initialize( theApp );
1979 QWidget* aParent = application()->desktop();
1980 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
1983 //createAction( VISU_IMPORT_FROM_FILE, "", QIconSet(),
1984 // tr("MEN_IMPORT_FROM_FILE"), "", (CTRL + Key_I), aParent, false,
1985 // this, SLOT(OnImportFromFile()));
1987 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_IMPORT_MED"));
1988 createAction( VISU_IMPORT_FROM_FILE, tr("IMPORT_FROM_FILE"), QIconSet(aPixmap),
1989 tr("MEN_IMPORT_FROM_FILE"), "", (CTRL + Key_I), aParent, false,
1990 this, SLOT(OnImportFromFile()));
1992 createAction( VISU_IMPORT_TABLE, "", QIconSet(),
1993 tr("MEN_IMPORT_TABLE"), "", 0, aParent, false,
1994 this, SLOT(OnImportTableFromFile()));
1996 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP"));
1997 createAction( VISU_SCALAR_MAP, tr("MEN_SCALAR_MAP"), QIconSet(aPixmap),
1998 tr("MEN_SCALAR_MAP"), "", 0, aParent, false,
1999 this, SLOT(OnCreateScalarMap()));
2001 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_DEFORMED_SHAPE"));
2002 createAction( VISU_DEFORMED_SHAPE, tr("MEN_DEFORMED_SHAPE"), QIconSet(aPixmap),
2003 tr("MEN_DEFORMED_SHAPE"), "", 0, aParent, false,
2004 this, SLOT(OnCreateDeformedShape()));
2006 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP_ON_DEFORMED_SHAPE"));
2007 createAction( VISU_SCALAR_MAP_ON_DEFORMED_SHAPE, tr("MEN_SCALAR_MAP_ON_DEFORMED_SHAPE"), QIconSet(aPixmap),
2008 tr("MEN_SCALAR_MAP_ON_DEFORMED_SHAPE"), "", 0, aParent, false,
2009 this, SLOT(OnCreateScalarMapOnDeformedShape()));
2011 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_VECTORS"));
2012 createAction( VISU_VECTORS, tr("MEN_VECTORS"), QIconSet(aPixmap),
2013 tr("MEN_VECTORS"), "", 0, aParent, false,
2014 this, SLOT(OnCreateVectors()));
2016 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ISO_SURFACES"));
2017 createAction( VISU_ISO_SURFACES, tr("MEN_ISO_SURFACES"), QIconSet(aPixmap),
2018 tr("MEN_ISO_SURFACES"), "", 0, aParent, false,
2019 this, SLOT(OnCreateIsoSurfaces()));
2021 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_PLANES"));
2022 createAction( VISU_CUT_PLANES, tr("MEN_CUT_PLANES"), QIconSet(aPixmap),
2023 tr("MEN_CUT_PLANES"), "", 0, aParent, false,
2024 this, SLOT(OnCreateCutPlanes()));
2026 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_STREAM_LINES"));
2027 createAction( VISU_STREAM_LINES, tr("MEN_STREAM_LINES"), QIconSet(aPixmap),
2028 tr("MEN_STREAM_LINES"), "", 0, aParent, false,
2029 this, SLOT(OnCreateStreamLines()));
2031 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_LINES"));
2032 createAction( VISU_CUT_LINES, tr("MEN_CUT_LINES"), QIconSet(aPixmap),
2033 tr("MEN_CUT_LINES"), "", 0, aParent, false,
2034 this, SLOT(OnCreateCutLines()));
2036 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT_3D"));
2037 createAction( VISU_PLOT_3D, tr("MEN_PLOT_3D"), QIconSet(aPixmap),
2038 tr("MEN_PLOT_3D"), "", 0, aParent, false,
2039 this, SLOT(OnCreatePlot3D()));
2041 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT2D"));
2042 createAction( VISU_PLOT2D, tr("MEN_CREATE_PLOT2D"), QIconSet(aPixmap),
2043 tr("MEN_CREATE_PLOT2D"), "", 0, aParent, false,
2044 this, SLOT(OnCreatePlot2dView()));
2046 createAction( VISU_DELETE_OBJS, tr("MEN_DELETE_OBJS"), QIconSet(),
2047 tr("MEN_DELETE_OBJS"), "", 0, aParent, false,
2048 this, SLOT(OnDeleteObjects()));
2050 createAction( VISU_SHOW_TABLE, tr("MEN_SHOW_TABLE"), QIconSet(),
2051 tr("MEN_SHOW_TABLE"), "", 0, aParent, false,
2052 this, SLOT(OnShowTable()));
2054 createAction( VISU_CREATE_CURVES, tr("MEN_CREATE_CURVES"), QIconSet(),
2055 tr("MEN_CREATE_CURVES"), "", 0, aParent, false,
2056 this, SLOT(OnPlotData()));
2058 createAction( VISU_EXPORT_TABLE, tr("MEN_EXPORT_TABLE"), QIconSet(),
2059 tr("MEN_EXPORT_TABLE"), "", 0, aParent, false,
2060 this, SLOT(OnExportTableToFile()));
2062 createAction( VISU_IMPORT_MED_STRUCTURE, tr("MEN_IMPORT_MED_STRUCTURE"), QIconSet(),
2063 tr("MEN_IMPORT_MED_STRUCTURE"), "", 0, aParent, false,
2064 this, SLOT(OnImportMedField()));
2066 createAction( VISU_IMPORT_MED_TIMESTAMP, tr("MEN_IMPORT_MED_TIMESTAMP"), QIconSet(),
2067 tr("MEN_IMPORT_MED_TIMESTAMP"), "", 0, aParent, false,
2068 this, SLOT(OnImportMedField()));
2070 createAction( VISU_IMPORT_MED_FIELD, tr("MEN_IMPORT_MED_FIELD"), QIconSet(),
2071 tr("MEN_IMPORT_MED_FIELD"), "", 0, aParent, false,
2072 this, SLOT(OnImportMedField()));
2074 createAction( VISU_CREATE_PRS, tr("MEN_CREATE_PRS"), QIconSet(),
2075 tr("MEN_CREATE_PRS"), "", 0, aParent, false,
2076 this, SLOT(OnCreateMesh()));
2078 createAction( VISU_CREATE_MANY_PRS, tr("MEN_CREATE_MANY_PRS"), QIconSet(),
2079 tr("MEN_CREATE_MANY_PRS"), "", 0, aParent, false,
2080 this, SLOT(OnCreateManyMesh()));
2082 createAction( VISU_TRANSLATE_PRS, tr("MEN_TRANSLATE_PRS"), QIconSet(),
2083 tr("MEN_TRANSLATE_PRS"), "", 0, aParent, false,
2084 this, SLOT(OnTranslatePrs()));
2086 createAction( VISU_MERGE_SCALAR_BARS, tr("MEN_MERGE_SCALAR_BARS"), QIconSet(),
2087 tr("MEN_MERGE_SCALAR_BARS"), "", 0, aParent, false,
2088 this, SLOT(OnMergeScalarBars()));
2090 createAction( VISU_FREE_SCALAR_BARS, tr("MEN_FREE_SCALAR_BARS"), QIconSet(),
2091 tr("MEN_FREE_SCALAR_BARS"), "", 0, aParent, false,
2092 this, SLOT(OnFreeScalarBars()));
2094 createAction( VISU_ERASE, tr("MEN_ERASE"), QIconSet(),
2095 tr("MEN_ERASE"), "", 0, aParent, false,
2096 this, SLOT(OnErasePrs()));
2098 createAction( VISU_DISPLAY, tr("MEN_DISPLAY"), QIconSet(),
2099 tr("MEN_DISPLAY"), "", 0, aParent, false,
2100 this, SLOT(OnDisplayPrs()));
2102 createAction( VISU_DISPLAY_ONLY, tr("MEN_DISPLAY_ONLY"), QIconSet(),
2103 tr("MEN_DISPLAY_ONLY"), "", 0, aParent, false,
2104 this, SLOT(OnDisplayOnlyPrs()));
2106 createAction( VISU_COPY_PRS, tr("MEN_COPY_PRS"), QIconSet(),
2107 tr("MEN_COPY_PRS"), "", 0, aParent, false,
2108 this, SLOT(OnCopyPresentation()));
2110 createAction( VISU_CURVE_PROPS, tr("MEN_CURVE_PROPS"), QIconSet(),
2111 tr("MEN_CURVE_PROPS"), "", 0, aParent, false,
2112 this, SLOT(OnCurveProperties()));
2114 createAction( VISU_RENAME, tr("MEN_RENAME"), QIconSet(), tr("MEN_RENAME"), "", 0, aParent, false,
2115 this, SLOT(OnRename()));
2117 createAction( VISU_EDIT_CONTAINER, tr("MEN_EDIT_CONTAINER"), QIconSet(),
2118 tr("MEN_EDIT_CONTAINER"), "", 0, aParent, false,
2119 this, SLOT(OnEditContainer()));
2121 createAction( VISU_CLEAR_CONTAINER, tr("MEN_CLEAR_CONTAINER"), QIconSet(),
2122 tr("MEN_CLEAR_CONTAINER"), "", 0, aParent, false,
2123 this, SLOT(OnClearContainer()));
2125 createAction( VISU_SAVE_VIEW_PARAMS, tr("MEN_SAVE_VIEWPARAMS"), QIconSet(),
2126 tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
2127 this, SLOT(OnSaveViewParams()));
2128 createAction( VISU_SAVE_VIEW_PARAMS_1, tr("MEN_SAVE_VIEWPARAMS"), QIconSet(),
2129 tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
2130 this, SLOT(OnSaveViewParams()));
2132 createAction( VISU_RESTORE_VIEW_PARAMS, tr("MEN_RESTORE_VIEWPARAMS"), QIconSet(),
2133 tr("MEN_RESTORE_VIEWPARAMS"), "", 0, aParent, false,
2134 this, SLOT(OnRestoreViewParams()));
2136 //createAction( VISU_DELETE_VIEW_PARAMS, tr("MEN_DELETE_VIEWPARAMS"), QIconSet(),
2137 // tr("MEN_DELETE_VIEWPARAMS"), "", 0, aParent, false,
2138 // this, SLOT(OnDeleteObjects()));
2140 createAction( VISU_ARRANGE_ACTORS, tr("MEN_ARRANGE_ACTORS"), QIconSet(),
2141 tr("MEN_ARRANGE_ACTORS"), "", 0, aParent, false,
2142 this, SLOT(OnArrangeActors()));
2144 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_POINTS"));
2145 createAction( VISU_POINTS, tr("MEN_POINTS"), QIconSet(aPixmap),
2146 tr("MEN_POINTS"), "", 0, aParent, false,
2147 this, SLOT(OnMakePoints()));
2149 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_WIREFRAME"));
2150 createAction( VISU_WIREFRAME, tr("MEN_WIREFRAME"), QIconSet(aPixmap),
2151 tr("MEN_WIREFRAME"), "", 0, aParent, false,
2152 this, SLOT(OnMakeWireframe()));
2154 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SURFACE"));
2155 createAction( VISU_SURFACE, tr("MEN_SURFACE"), QIconSet(aPixmap),
2156 tr("MEN_SURFACE"), "", 0, aParent, false,
2157 this, SLOT(OnMakeSurface()));
2159 createAction( VISU_INSIDEFRAME, tr("MEN_INSIDEFRAME"), QIconSet(),
2160 tr("MEN_INSIDEFRAME"), "", 0, aParent, false,
2161 this, SLOT(OnMakeInsideframe()));
2163 createAction( VISU_SURFACEFRAME, tr("MEN_SURFACEFRAME"), QIconSet(),
2164 tr("MEN_SURFACEFRAME"), "", 0, aParent, false,
2165 this, SLOT(OnMakeSurfaceframe()));
2167 createAction( VISU_SHRINK, tr("MEN_SHRINK"), QIconSet(),
2168 tr("MEN_SHRINK"), "", 0, aParent, false,
2169 this, SLOT(OnMakeShrink()));
2171 createAction( VISU_UNSHRINK, tr("MEN_UNSHRINK"), QIconSet(),
2172 tr("MEN_UNSHRINK"), "", 0, aParent, false,
2173 this, SLOT(OnMakeShrink()));
2175 createAction( VISU_SHADING, tr("MEN_SHADING"), QIconSet(),
2176 tr("MEN_SHADING"), "", 0, aParent, false,
2177 this, SLOT(OnSetShadingOn()));
2179 createAction( VISU_NOSHADING, tr("MEN_NOSHADING"), QIconSet(),
2180 tr("MEN_NOSHADING"), "", 0, aParent, false,
2181 this, SLOT(OnSetShadingOff()));
2183 createAction( VISU_CELL_COLOR, tr("MEN_CELL_COLOR"), QIconSet(),
2184 tr("MEN_CELL_COLOR"), "", 0, aParent, false,
2185 this, SLOT(OnChangeColor()));
2187 createAction( VISU_COLOR, tr("MEN_COLOR"), QIconSet(),
2188 tr("MEN_COLOR"), "", 0, aParent, false,
2189 this, SLOT(OnChangeColor()));
2191 createAction( VISU_EDGE_COLOR, tr("MEN_EDGE_COLOR"), QIconSet(),
2192 tr("MEN_EDGE_COLOR"), "", 0, aParent, false,
2193 this, SLOT(OnChangeWireframeColor()));
2195 createAction( VISU_OPACITY, tr("MEN_OPACITY"), QIconSet(),
2196 tr("MEN_OPACITY"), "", 0, aParent, false,
2197 this, SLOT(OnChangeOpacity()));
2199 createAction( VISU_LINE_WIDTH, tr("MEN_LINE_WIDTH"), QIconSet(),
2200 tr("MEN_LINE_WIDTH"), "", 0, aParent, false,
2201 this, SLOT(OnChangeLines()));
2204 createAction( VISU_EDIT_SCALARMAP, tr("MEN_EDIT_PRS"), QIconSet(),
2205 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2206 this, SLOT(OnEditScalarMap()));
2208 createAction( VISU_EDIT_DEFORMEDSHAPE, tr("MEN_EDIT_PRS"), QIconSet(),
2209 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2210 this, SLOT(OnEditDeformedShape()));
2212 createAction( VISU_EDIT_CUTPLANES, tr("MEN_EDIT_PRS"), QIconSet(),
2213 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2214 this, SLOT(OnEditCutPlanes()));
2216 createAction( VISU_EDIT_CUTLINES, tr("MEN_EDIT_PRS"), QIconSet(),
2217 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2218 this, SLOT(OnEditCutLines()));
2220 createAction( VISU_EDIT_ISOSURFACE, tr("MEN_EDIT_PRS"), QIconSet(),
2221 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2222 this, SLOT(OnEditIsoSurfaces()));
2224 createAction( VISU_EDIT_VECTORS, tr("MEN_EDIT_PRS"), QIconSet(),
2225 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2226 this, SLOT(OnEditVectors()));
2228 createAction( VISU_EDIT_STREAMLINES, tr("MEN_EDIT_PRS"), QIconSet(),
2229 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2230 this, SLOT(OnEditStreamLines()));
2232 createAction( VISU_EDIT_PLOT3D, tr("MEN_EDIT_PRS"), QIconSet(),
2233 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2234 this, SLOT(OnEditPlot3D()));
2236 createAction( VISU_EDIT_SCALARMAPONDEFORMEDSHAPE, tr("MEN_EDIT_PRS"), QIconSet(),
2237 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2238 this, SLOT(OnEditScalarMapOnDeformedShape()));
2241 createAction( VISU_CREATE_TABLE, tr("MEN_CREATE_TABLE"), QIconSet(),
2242 tr("MEN_CREATE_TABLE"), "", 0, aParent, false,
2243 this, SLOT(OnCreateTable()));
2245 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SWEEP"));
2246 createAction( VISU_SWEEP, tr("MEN_SWEEP"), QIconSet(aPixmap),
2247 tr("MEN_SWEEP"), "", 0, aParent, false,
2248 this, SLOT(OnSweep()));
2250 createAction( VISU_CLIPPING, tr("MEN_CLIPPING"), QIconSet(),
2251 tr("MEN_CLIPPING"), "", 0, aParent, false,
2252 this, SLOT(OnClippingPlanes()));
2254 createAction( VISU_SELECTION_INFO, tr("MEN_SELECTION_INFO"), QIconSet(),
2255 tr("MEN_SELECTION_INFO"), "", 0, aParent, false,
2256 this, SLOT(OnSelectionInfo()));
2258 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_TIMEANIMATION"));
2259 createAction( VISU_ANIMATION, tr("MEN_ANIMATION"), QIconSet(aPixmap),
2260 tr("MEN_ANIMATION"), "", 0, aParent, false,
2261 this, SLOT(OnTimeAnimation()));
2263 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ERASE_ALL"));
2264 createAction( VISU_ERASE_ALL, tr("MEN_ERASE_ALL"), QIconSet(aPixmap),
2265 tr("MEN_ERASE_ALL"), "", 0, aParent, false,
2266 this, SLOT(OnEraseAll()));
2268 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_GLOBAL_SELECTION"));
2269 createAction( VISU_GLOBAL_SELECTION, tr("MEN_GLOBAL_SELECTION"), QIconSet(aPixmap),
2270 tr("MEN_GLOBAL_SELECTION"), "", 0, aParent, false,
2273 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PARTIAL_SELECTION"));
2274 createAction( VISU_PARTIAL_SELECTION, tr("MEN_PARTIAL_SELECTION"), QIconSet(aPixmap),
2275 tr("MEN_PARTIAL_SELECTION"), "", 0, aParent, false,
2278 createAction( VISU_SHOW_ANIMATION, tr("MEN_SHOW_ANIMATION"), QIconSet(),
2279 tr("MEN_SHOW_ANIMATION"), "", 0, aParent, false,
2280 this, SLOT(OnShowAnimation()));
2282 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT_3D"));
2283 createAction( VISU_PLOT3D_FROM_CUTPLANE, tr("MEN_PLOT3D_FROM_CUTPLANE"), QIconSet(aPixmap),
2284 tr("MEN_PLOT3D_FROM_CUTPLANE"), "", 0, aParent, false,
2285 this, SLOT(OnPlot3dFromCutPlane()));
2292 // Add actions to menus
2294 aMenuId = createMenu( tr( "MEN_DESK_FILE" ), -1 );
2295 createMenu( separator(), aMenuId, -1, 10 );
2297 int anImportId = createMenu( tr( "MEN_IMPORT" ), aMenuId, -1, 10 );
2298 createMenu( VISU_IMPORT_FROM_FILE, anImportId ); // import from file
2299 createMenu( VISU_IMPORT_TABLE, anImportId ); // import table
2301 aMenuId = createMenu( tr( "MEN_VISUALIZATION" ), -1, -1, 30 );
2302 createMenu( VISU_SCALAR_MAP, aMenuId, 10 ); // scalar map
2303 createMenu( VISU_DEFORMED_SHAPE, aMenuId, 10 ); // deformed shape
2304 createMenu( VISU_VECTORS, aMenuId, 10 ); // vectors
2305 createMenu( VISU_ISO_SURFACES, aMenuId, 10 ); // iso surfaces
2306 createMenu( VISU_CUT_PLANES, aMenuId, 10 ); // cut planes
2307 createMenu( VISU_CUT_LINES, aMenuId, 10 ); // cut lines
2308 createMenu( VISU_STREAM_LINES, aMenuId, 10 ); // stream lines
2309 createMenu( VISU_PLOT_3D, aMenuId, 10 ); // Plot3d
2310 createMenu( VISU_SCALAR_MAP_ON_DEFORMED_SHAPE, aMenuId, 10 ); // scalar map on deformed shape
2312 aMenuId = createMenu( tr( "MEN_SELECTION" ), -1, -1, 30 );
2313 createMenu( VISU_SELECTION_INFO, aMenuId, 10 ); // selection info
2315 aMenuId = createMenu( tr( "MEN_REPRESENTATION" ), -1, -1, 30 );
2317 createMenu( tr( "MEN_DISPLAY_SELECTION" ), aMenuId, 10 ); // display selection
2318 createMenu( VISU_POINTS, parentId, 10 ); // points
2319 createMenu( VISU_WIREFRAME, parentId, 10 ); // wireframe
2320 createMenu( VISU_SURFACE, parentId, 10 ); // surface
2321 createMenu( VISU_ERASE_ALL, aMenuId, 10 ); // erase all
2322 createMenu( VISU_GLOBAL_SELECTION, aMenuId, 10 ); // global selection
2323 createMenu( VISU_PARTIAL_SELECTION, aMenuId, 10 ); // partial selection
2330 int aToolId = createTool( tr("TOOL_IMPORT") );
2331 createTool( VISU_IMPORT_FROM_FILE, aToolId );
2333 aToolId = createTool(tr("TOOL_VISUALISATION"));
2334 createTool( VISU_SCALAR_MAP, aToolId );
2335 createTool( VISU_DEFORMED_SHAPE, aToolId );
2336 createTool( VISU_VECTORS, aToolId );
2337 createTool( VISU_ISO_SURFACES, aToolId );
2338 createTool( VISU_CUT_PLANES, aToolId );
2339 createTool( VISU_CUT_LINES, aToolId );
2340 createTool( VISU_STREAM_LINES, aToolId );
2341 createTool( VISU_PLOT_3D, aToolId );
2342 createTool( VISU_SCALAR_MAP_ON_DEFORMED_SHAPE, aToolId );
2344 aToolId = createTool(tr("TOOL_REPRESENTATION"));
2345 createTool( VISU_POINTS, aToolId );
2346 createTool( VISU_WIREFRAME, aToolId );
2347 createTool( VISU_SURFACE, aToolId );
2348 createTool( VISU_ERASE_ALL, aToolId );
2349 createTool( VISU_GLOBAL_SELECTION, aToolId );
2350 createTool( VISU_PARTIAL_SELECTION, aToolId );
2357 // Prepare popup menus
2358 QtxPopupMgr* mgr = popupMgr();
2360 // VISU root commands
2361 mgr->insert( action( VISU_IMPORT_FROM_FILE ), -1, -1, -1 ); // import MED file
2362 mgr->insert( action( VISU_IMPORT_TABLE ), -1, -1, -1 ); // import tables from file
2363 mgr->insert( action( VISU_PLOT2D ), -1, -1, -1 ); // create Plot2d View
2365 //mgr->insert( action( VISU_IMPORT_MED ), -1, -1, -1 ); // import MED structure from MED module
2368 mgr->insert( action( VISU_SCALAR_MAP ), -1, -1, -1 ); // scalar bar
2369 mgr->insert( action( VISU_ISO_SURFACES ), -1, -1, -1 ); // iso surface
2370 mgr->insert( action( VISU_CUT_PLANES ), -1, -1, -1 ); // cut planes
2371 mgr->insert( action( VISU_CUT_LINES ), -1, -1, -1 ); // cut lines
2372 mgr->insert( action( VISU_DEFORMED_SHAPE ), -1, -1, -1 ); // deformed shape
2373 mgr->insert( action( VISU_VECTORS ), -1, -1, -1 ); // vectors
2374 mgr->insert( action( VISU_STREAM_LINES ), -1, -1, -1 ); // stream lines
2375 mgr->insert( action( VISU_PLOT_3D ), -1, -1, -1 ); // Plot3d
2376 mgr->insert( action( VISU_SCALAR_MAP_ON_DEFORMED_SHAPE ), -1, -1, -1 ); // scalar map on deformed shape
2378 mgr->insert( action( VISU_CREATE_PRS ), -1, -1, -1 ); // create presentation
2379 mgr->insert( action( VISU_CREATE_MANY_PRS ), -1, -1, -1 ); // create presentations
2381 mgr->insert( action( VISU_CREATE_TABLE ), -1, -1, -1 ); // create table
2384 mgr->insert( action( VISU_EDIT_SCALARMAP ), -1, -1, -1 );
2385 mgr->insert( action( VISU_EDIT_DEFORMEDSHAPE ), -1, -1, -1 );
2386 mgr->insert( action( VISU_EDIT_CUTPLANES ), -1, -1, -1 );
2387 mgr->insert( action( VISU_EDIT_CUTLINES ), -1, -1, -1 );
2388 mgr->insert( action( VISU_EDIT_ISOSURFACE ), -1, -1, -1 );
2389 mgr->insert( action( VISU_EDIT_VECTORS ), -1, -1, -1 );
2390 mgr->insert( action( VISU_EDIT_STREAMLINES ), -1, -1, -1 );
2391 mgr->insert( action( VISU_EDIT_PLOT3D ), -1, -1, -1 );
2392 mgr->insert( action( VISU_EDIT_SCALARMAPONDEFORMEDSHAPE ), -1, -1, -1 );
2393 mgr->insert( action( VISU_EDIT_CONTAINER ), -1, -1, -1 );
2396 mgr->insert( action( VISU_RENAME ), -1, -1, -1 );
2399 mgr->insert( action( VISU_COPY_PRS ), -1, -1, -1 );
2402 mgr->insert( action( VISU_CLEAR_CONTAINER ), -1, -1, -1 );
2405 //mgr->insert( action( VISU_SHOW_TABLE ), -1, -1, -1 ); // show table
2406 //mgr->insert( action( VISU_CREATE_CURVES ), -1, -1, -1 ); // create curves
2407 //mgr->insert( action( VISU_EXPORT_TABLE ), -1, -1, -1 ); // export table
2409 mgr->insert( separator(), -1, -1, -1 );
2411 mgr->insert( action( VISU_ERASE ), -1, -1, -1 ); // erase
2412 mgr->insert( action( VISU_DISPLAY ), -1, -1, -1 ); // display
2413 mgr->insert( action( VISU_DISPLAY_ONLY ), -1, -1, -1 ); // display only
2415 // "Representation" submenu
2416 int parentId = mgr->insert( tr( "MEN_REPRESENTATION" ), -1, -1 );
2417 mgr->insert( action( VISU_POINTS ) , parentId, -1, -1 ); // points
2418 mgr->insert( action( VISU_WIREFRAME ) , parentId, -1, -1 ); // wireframe
2419 mgr->insert( action( VISU_SURFACE ) , parentId, -1, -1 ); // surface
2420 mgr->insert( action( VISU_INSIDEFRAME ) , parentId, -1, -1 ); // insideframe
2421 mgr->insert( action( VISU_SURFACEFRAME ), parentId, -1, -1 ); // surfaceframe
2422 mgr->insert( action( VISU_SHRINK ) , parentId, -1, -1 ); // shrink
2423 mgr->insert( action( VISU_UNSHRINK ) , parentId, -1, -1 ); // unshrink
2424 mgr->insert( separator(), parentId, -1, -1 );
2425 mgr->insert( action( VISU_SHADING ) , parentId, -1, -1 ); // shading
2426 mgr->insert( action( VISU_NOSHADING ) , parentId, -1, -1 ); // noshading
2428 // "Properties" submenu
2429 parentId = mgr->insert( tr( "MEN_PROPERTIES" ), -1, -1 );
2430 mgr->insert( action( VISU_CELL_COLOR ), parentId, -1, -1 ); // cell color
2431 mgr->insert( action( VISU_EDGE_COLOR ), parentId, -1, -1 ); // edge color
2432 mgr->insert( action( VISU_COLOR ) , parentId, -1, -1 ); // color
2433 mgr->insert( action( VISU_OPACITY ) , parentId, -1, -1 ); // opacity
2434 mgr->insert( action( VISU_LINE_WIDTH ), parentId, -1, -1 ); // line width
2436 mgr->insert( separator(), -1, -1, -1 );
2438 // Other presentations management
2439 mgr->insert( action( VISU_TRANSLATE_PRS ), -1, -1, -1 );
2440 mgr->insert( action( VISU_CLIPPING ), -1, -1, -1 );
2442 mgr->insert( action( VISU_MERGE_SCALAR_BARS ), -1, -1, -1 );
2443 mgr->insert( action( VISU_FREE_SCALAR_BARS ), -1, -1, -1 );
2445 mgr->insert( action( VISU_SWEEP ), -1, -1, -1 );
2446 mgr->insert( action( VISU_ANIMATION ), -1, -1, -1 );
2448 mgr->insert( separator(), -1, -1, -1 );
2450 // view parameters commands
2451 mgr->insert( action( VISU_SAVE_VIEW_PARAMS ), -1, -1, -1 ); // save view params
2452 mgr->insert( action( VISU_SAVE_VIEW_PARAMS_1 ), -1, -1, -1 ); // save view params
2453 mgr->insert( action( VISU_RESTORE_VIEW_PARAMS ), -1, -1, -1 ); // restore view params
2454 //mgr->insert( action( VISU_DELETE_VIEW_PARAMS ), -1, -1, -1 ); // delete view params
2456 mgr->insert( action( VISU_ARRANGE_ACTORS ), -1, -1, -1 ); // arrange actors
2458 mgr->insert( action( VISU_CURVE_PROPS ), -1, -1, -1 ); // curve properties
2460 mgr->insert( action( VISU_SELECTION_INFO ), -1, -1, -1 ); // Selection info
2464 QString aPrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
2465 "'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE'");
2467 // VISU root commands
2468 QString aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TVISUGEN'";
2469 mgr->setRule( action( VISU_IMPORT_FROM_FILE ), aRule, true );
2470 mgr->setRule( action( VISU_IMPORT_TABLE ), aRule, true );
2471 mgr->setRule( action( VISU_PLOT2D ), aRule, true );
2473 // timestamp commands
2474 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TTIMESTAMP'";
2475 mgr->setRule( action( VISU_SCALAR_MAP ), aRule, true );
2476 mgr->setRule( action( VISU_ISO_SURFACES ), aRule, true );
2477 mgr->setRule( action( VISU_CUT_PLANES ), aRule, true );
2478 mgr->setRule( action( VISU_CUT_LINES ), aRule, true );
2479 mgr->setRule( action( VISU_PLOT_3D ), aRule, true );
2480 aRule += " and nbComponents>1";
2481 mgr->setRule( action( VISU_DEFORMED_SHAPE ), aRule, true );
2482 mgr->setRule( action( VISU_VECTORS ), aRule, true );
2483 mgr->setRule( action( VISU_STREAM_LINES ), aRule, true );
2484 mgr->setRule( action( VISU_SCALAR_MAP_ON_DEFORMED_SHAPE ), aRule, true );
2486 // display/erase commands
2487 QString andInvisible = " and (((not isVisible) and isActiveView) or (not isActiveView))";
2488 QString aTableOrCont = "(type='VISU::TTABLE' and nbChildren>0) or type='VISU::TCONTAINER'";
2489 QString orCurveVisible = "or (type='VISU::TCURVE' and isVisible)";
2490 QString orCurveInvisible = "or (type='VISU::TCURVE'" + andInvisible + ")";
2491 QString aPrsVisible = "(($type in {'VISU::TMESH' " + aPrsAll + "}) and isVisible)";
2492 QString aPrsInvisible = "(($type in {'VISU::TMESH' " + aPrsAll + "})" + andInvisible + ")";
2493 QString aComponent = "( selcount=1 and canBeDisplayed and isVisuComponent )";
2495 QString anEraseRule = "( selcount>0 and ({true} in $canBeDisplayed) and (" + aPrsVisible +
2496 " or (client='ObjectBrowser' and (" + aTableOrCont + orCurveVisible + "))) ) or " + aComponent;
2498 QString aDisplayRule = "( selcount>0 and ({true} in $canBeDisplayed) and (" + aPrsInvisible +
2499 " or (client='ObjectBrowser' and (" + aTableOrCont + orCurveInvisible + "))) ) or" + aComponent;
2501 QString aDOnlyRule = "( selcount>0 and ({true} in $canBeDisplayed) and (($type in {'VISU::TMESH' " + aPrsAll + "})"
2502 " or (client='ObjectBrowser' and ((type='VISU::TTABLE' and nbChildren>0) or"
2503 " ($type in {'VISU::TCURVE' 'VISU::TCONTAINER'})))) ) or" + aComponent;
2505 mgr->setRule( action( VISU_ERASE ), anEraseRule, true );
2506 mgr->setRule( action( VISU_DISPLAY ), aDisplayRule, true );
2507 mgr->setRule( action( VISU_DISPLAY_ONLY ), aDOnlyRule, true );
2509 aRule = "selcount>0 and $type in {'VISU::TMESH' " + aPrsAll + "}";
2510 mgr->setRule( action( VISU_TRANSLATE_PRS ), aRule, true );
2512 aRule = "selcount>1 and $type in {'VISU::TMESH' " + aPrsAll + "}";
2513 mgr->setRule( action( VISU_MERGE_SCALAR_BARS ), aRule, true );
2514 mgr->setRule( action( VISU_FREE_SCALAR_BARS ), aRule, true );
2517 aRule = "selcount=1 and type='VISU::TVIEW3D' and activeView='VTKViewer'";
2518 mgr->setRule( action( VISU_SAVE_VIEW_PARAMS_1 ), aRule, true );
2519 mgr->setRule( action( VISU_SAVE_VIEW_PARAMS ), "client='VTKViewer' and selcount=0 and activeView='VTKViewer'", true );
2520 mgr->setRule( action( VISU_RESTORE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D' and activeView='VTKViewer'", true );
2521 //mgr->setRule( action( VISU_DELETE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D'", true );
2523 mgr->setRule( action( VISU_ARRANGE_ACTORS ), "client='VTKViewer' and selcount=0", true );
2525 // 3D presentations commands
2526 QString aPrsType = " and $type in {'VISU::TMESH' " + aPrsAll + "}";
2527 QString aInsideType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE'}";
2528 QString aSurfFrameType = " and $type in {'VISU::TMESH'}";
2529 QString aSurfType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
2530 " 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE'}";
2531 QString aShrinkType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' "
2532 "'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE'}";
2533 QString aLineType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
2534 "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' }";
2536 aRule = "selcount=1";
2537 mgr->setRule( action( VISU_CLIPPING ), aRule + aPrsType, true );
2539 // "Representation" submenu
2540 QString aNotPoints = " and $representation in {'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}";
2541 QString aNotWirefr = " and $representation in {'VISU::POINT' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}";
2542 QString aNotSurfac = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}";
2543 QString aNotInside = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::SURFACEFRAME'}";
2544 QString aNotSurffr = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}";
2546 mgr->setRule( action( VISU_POINTS ) , aRule + aPrsType + aNotPoints, true );
2547 mgr->setRule( action( VISU_WIREFRAME ) , aRule + aPrsType + aNotWirefr, true );
2548 mgr->setRule( action( VISU_SURFACE ) , aRule + aSurfType + aNotSurfac, true );
2549 mgr->setRule( action( VISU_INSIDEFRAME ) , aRule + aInsideType + aNotInside, true );
2550 mgr->setRule( action( VISU_SURFACEFRAME ), aRule + aSurfFrameType + aNotSurffr, true );
2552 mgr->setRule( action( VISU_SHRINK ) , aRule + aShrinkType + " and isShrunk=0", true );
2553 mgr->setRule( action( VISU_UNSHRINK ), aRule + aShrinkType + " and isShrunk=1", true );
2555 mgr->setRule( action( VISU_SHADING ) , aRule + " and isScalarMapAct=1 and isShading=0", true );
2556 mgr->setRule( action( VISU_NOSHADING ), aRule + " and isScalarMapAct=1 and isShading=1", true );
2558 // "Properties" submenu
2559 mgr->setRule( action( VISU_CELL_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'", true );
2560 mgr->setRule( action( VISU_EDGE_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'", true );
2561 mgr->setRule( action( VISU_COLOR ), aRule + " and ((type='VISU::TMESH'"
2562 " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}) "
2563 "or (type='VISU::TDEFORMEDSHAPE' and hasActor=1))", true );
2564 mgr->setRule( action( VISU_OPACITY ), aRule + aShrinkType + " and hasActor=1", true );
2565 mgr->setRule( action( VISU_LINE_WIDTH ), aRule + aLineType + " and hasActor=1", true );
2568 QString aCurveAll = "'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER'";
2570 aRule = "selcount=1 and ($type in {'VISU::TVIEW3D' 'VISU::TMESH' " + aCurveAll + " " + aPrsAll + "})";
2571 mgr->setRule( action( VISU_RENAME ), aRule, true );
2573 // copy presentation command
2574 aRule = "selcount=1 and ($type in {" + aPrsAll + "})";
2575 mgr->setRule( action( VISU_COPY_PRS ), aRule, true );
2578 aRule = "selcount=1 and type='VISU::TCURVE'";
2579 mgr->setRule( action( VISU_CURVE_PROPS ), aRule, true );
2581 // curve container commands
2582 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TCONTAINER'";
2583 mgr->setRule( action( VISU_EDIT_CONTAINER ), aRule, true );
2584 mgr->setRule( action( VISU_CLEAR_CONTAINER ), aRule, true );
2586 mgr->setRule( action( VISU_EDIT_SCALARMAP ),
2587 "selcount=1 and type='VISU::TSCALARMAP'", true );
2588 mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPE ),
2589 "selcount=1 and type='VISU::TDEFORMEDSHAPE'", true );
2590 mgr->setRule( action( VISU_EDIT_SCALARMAPONDEFORMEDSHAPE ),
2591 "selcount=1 and type='VISU::TSCALARMAPONDEFORMEDSHAPE'", true );
2592 mgr->setRule( action( VISU_EDIT_CUTPLANES ),
2593 "selcount=1 and type='VISU::TCUTPLANES'", true );
2594 mgr->setRule( action( VISU_EDIT_CUTLINES ),
2595 "selcount=1 and type='VISU::TCUTLINES'", true );
2596 mgr->setRule( action( VISU_EDIT_ISOSURFACE ),
2597 "selcount=1 and type='VISU::TISOSURFACE'", true );
2598 mgr->setRule( action( VISU_EDIT_VECTORS ),
2599 "selcount=1 and type='VISU::TVECTORS'", true );
2600 mgr->setRule( action( VISU_EDIT_STREAMLINES ),
2601 "selcount=1 and type='VISU::TSTREAMLINES'", true );
2602 mgr->setRule( action( VISU_EDIT_PLOT3D ),
2603 "selcount=1 and type='VISU::TPLOT3D'", true );
2605 aRule = "selcount=1 and type='VISU::TCUTLINES' and nbNamedChildren=0";
2606 mgr->setRule( action( VISU_CREATE_TABLE ), aRule, true );
2608 aRule = "selcount=1 and ($type in {" + aPrsAll + "})";
2609 mgr->setRule( action( VISU_SWEEP ), aRule, true );
2611 // "Selection info" popup item
2612 aRule = "client='VTKViewer' and selcount=1" + aInsideType;
2613 mgr->setRule( action( VISU_SELECTION_INFO ), aRule, true );
2615 aRule = "client='ObjectBrowser' and selcount>0";
2616 aRule += " and $type in {'VISU::TFIELD'}";
2617 aRule += " and nbTimeStamps>1";
2618 aRule += " and activeView in {'VTKViewer' 'VVTK'}";
2619 mgr->setRule( action( VISU_ANIMATION ), aRule, true );
2621 aRule = "client='ObjectBrowser' and $type in {'VISU::TENTITY' 'VISU::TFAMILY' 'VISU::TGROUP'}";
2622 mgr->setRule( action( VISU_CREATE_PRS ), aRule + " and selcount=1", true );
2623 mgr->setRule( action( VISU_CREATE_MANY_PRS ), aRule + " and selcount>1", true );
2625 //aRule = "client='ObjectBrowser' and type='MEDFIELD'";
2626 //mgr->setRule( action( VISU_IMPORT_MED ), aRule, true );
2629 //***************************************************************************
2630 void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, QString& theTitle )
2632 SalomeApp_Module::contextMenuPopup(theClient, theMenu, theTitle);
2634 OB_Browser* ob = getApp()->objectBrowser();
2635 bool isOBClient = (ob && theClient == ob->popupClientType());
2637 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2638 SALOME_ListIO aListIO;
2639 aSelectionMgr->selectedObjects(aListIO);
2641 if (aListIO.Extent() < 1) return;
2643 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2645 // Check if "Merge Scalar Range" can be applied
2647 SALOME_ListIteratorOfListIO It (aListIO);
2648 for (; It.More(); It.Next()) {
2649 Handle(SALOME_InteractiveObject)& anIO = It.Value();
2651 if (!anIO.IsNull() && anIO->hasEntry()) {
2652 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
2655 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSObject);
2656 if (CORBA::is_nil(aCORBAObject)) {
2657 _PTR(GenericAttribute) anAttr;
2658 if (aSObject->FindAttribute(anAttr, "AttributeComment")) {
2659 _PTR(AttributeComment) aComment (anAttr);
2660 string aComm = aComment->Value();
2661 QString strIn (aComm.c_str());
2662 VISU::Storable::TRestoringMap pMap;
2663 VISU::Storable::StrToMap(strIn, pMap);
2665 VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(pMap,"myType",&isExist).toInt();
2666 if (isExist && aType == VISU::TTIMESTAMP) {
2667 _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(aSObject);
2669 for (; anIter->More(); anIter->Next()) {
2670 aPrs = anIter->Value();
2671 if (!aPrs) continue;
2672 std::vector<VISU::Prs3d_i*> aSubList = GetPrs3dList(this, aPrs);
2673 nbPrs += aSubList.size();
2681 theMenu->insertSeparator();
2682 action( VISU_MERGE_SCALAR_BARS )->addTo(theMenu);
2683 action( VISU_FREE_SCALAR_BARS )->addTo(theMenu);
2686 // Check if some curves selected (for bug PAL10611)
2687 bool isCurves = false;
2688 bool isOneCutPlane = false;
2689 SALOME_ListIteratorOfListIO It1 (aListIO);
2690 for (; It1.More() && !isCurves; It1.Next()) {
2691 Handle(SALOME_InteractiveObject)& anIO = It1.Value();
2693 if (!anIO.IsNull() && anIO->hasEntry()) {
2694 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
2697 _PTR(GenericAttribute) anAttr;
2698 if (aSObject->FindAttribute(anAttr, "AttributeComment")) {
2699 _PTR(AttributeComment) aComment (anAttr);
2700 string aComm = aComment->Value();
2701 QString strIn (aComm.c_str());
2702 VISU::Storable::TRestoringMap pMap;
2703 VISU::Storable::StrToMap(strIn, pMap);
2705 VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(pMap,"myType",&isExist).toInt();
2706 if (isExist && aType == VISU::TCURVE) {
2709 CORBA::Object_var anObject = GetSelectedObj(GetAppStudy(this), anIO->getEntry());
2710 if (!CORBA::is_nil(anObject)) {
2711 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
2713 if (aPrsObject->GetType() == VISU::TCUTPLANES) {
2714 VISU::CutPlanes_i* aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
2716 isOneCutPlane = aCutPrs->GetNbPlanes() == 1;
2727 action( VISU_PLOT3D_FROM_CUTPLANE )->addTo(theMenu);
2729 theMenu->insertSeparator();
2731 // Check if some (nb > 0) removable objects selected
2732 if (isOBClient && IsRemovableSelected(this)) {
2733 action( VISU_DELETE_OBJS )->addTo(theMenu);
2736 action( myDisplay )->removeFrom(theMenu);
2737 action( myErase )->removeFrom(theMenu);
2738 action( myDisplayOnly )->removeFrom(theMenu);
2739 action( myEraseAll )->removeFrom(theMenu);
2742 // Check single selection
2743 if (aListIO.Extent() != 1) return;
2745 Handle(SALOME_InteractiveObject) anIO;
2746 VISU::Storable::TRestoringMap aMap;
2747 CORBA::Object_var anObject = GetSelectedObj( this, &anIO, &aMap);
2749 _PTR(SObject) SO = aCStudy->FindObjectID(anIO->getEntry());
2753 VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
2755 if (aType == VISU::TANIMATION) {
2756 action( VISU_SHOW_ANIMATION )->addTo(theMenu);
2758 } else if (isOBClient) {
2759 if (IsSObjectTable(SO)) {
2760 action( VISU_SHOW_TABLE )->addTo(theMenu);
2761 action( VISU_CREATE_CURVES )->addTo(theMenu);
2762 action( VISU_EXPORT_TABLE )->addTo(theMenu);
2763 theMenu->insertSeparator();
2765 if (!CORBA::is_nil(anObject)) {
2766 SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
2767 if (!CORBA::is_nil(aMED.in())) {
2768 action( VISU_IMPORT_MED_STRUCTURE )->addTo(theMenu);
2771 SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject); // "Import Structure"
2772 if (!CORBA::is_nil(aField)) {
2773 action( VISU_IMPORT_MED_TIMESTAMP )->addTo(theMenu); // "Import TimeStamp"
2776 _PTR(SObject) aSFather = SO->GetFather();
2778 _PTR(GenericAttribute) anAttr;
2779 aSFather->FindAttribute(anAttr, "AttributeName");
2781 _PTR(AttributeName) aName (anAttr);
2782 std::string aValue = aName->Value();
2783 if (strcmp(aValue.c_str(), "MEDFIELD") == 0) {
2784 action( VISU_IMPORT_MED_FIELD )->addTo(theMenu); // "Import Field"
2794 //***************************************************************************
2797 windows( QMap<int, int>& theMap ) const
2800 theMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::DockLeft );
2801 theMap.insert( SalomeApp_Application::WT_PyConsole, Qt::DockBottom );
2807 viewManagers( QStringList& theList ) const
2810 // append SVTK viewer only if there is no opened VVTK
2811 SUIT_ViewManager* vm = getApp()->getViewManager( VVTK_Viewer::Type(), false );
2812 if( vm && vm->getViewsCount()>0 )
2813 theList.append( VVTK_Viewer::Type() );
2815 theList.append( SVTK_Viewer::Type() );
2823 CORBA::String_var anIOR = GetVisuGen(this)->GetID();
2824 return QString(anIOR.in());
2830 activateModule( SUIT_Study* theStudy )
2832 SalomeApp_Module::activateModule( theStudy );
2834 setMenuShown( true );
2835 setToolShown( true );
2837 // Reset actions accelerator keys
2838 action(VISU_IMPORT_FROM_FILE)->setAccel(QKeySequence(CTRL + Key_I));
2846 deactivateModule( SUIT_Study* theStudy )
2848 setMenuShown( false );
2849 setToolShown( false );
2851 // Unset actions accelerator keys
2852 action(VISU_IMPORT_FROM_FILE)->setAccel(QKeySequence());
2854 SalomeApp_Module::deactivateModule( theStudy );
2860 createSelection() const
2862 return new VisuGUI_Selection( (SalomeApp_Module*)this );
2865 //******************************************************************
2866 void VisuGUI::studyActivated()
2868 GetVisuGen(this)->SetCurrentStudy(GetDSStudy(GetCStudy(GetAppStudy(this))));
2876 return new VisuGUI();
2881 void VisuGUI::createPreferences()
2883 // TAB: "Scalar Bar"
2884 int sbarTab = addPreference( tr( "VISU_SCALAR_BAR" ) );
2886 int rangeGr = addPreference( tr( "VISU_SCALAR_RANGE" ), sbarTab );
2887 setPreferenceProperty( rangeGr, "columns", 1 );
2889 int mode = addPreference( tr( "VISU_SCALAR_MODE" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_bar_mode" );
2891 modes.append( tr( "VISU_MODULUS" ) );
2892 modes.append( tr( "VISU_COMPONENT" ) + tr("1") );
2893 modes.append( tr( "VISU_COMPONENT" ) + tr("2") );
2894 modes.append( tr( "VISU_COMPONENT" ) + tr("3") );
2895 QValueList<QVariant> indices;
2896 indices.append( 0 );
2897 indices.append( 1 );
2898 indices.append( 2 );
2899 indices.append( 3 );
2900 setPreferenceProperty( mode, "strings", modes );
2901 setPreferenceProperty( mode, "indexes", indices );
2903 addPreference( tr( "VISU_LOGARITHMIC_SCALING" ), rangeGr, LightApp_Preferences::Bool, "VISU", "scalar_bar_logarithmic" );
2905 int rangetype = addPreference( tr( "VISU_RANGE_TO_USE" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_range_type" );
2907 types.append( tr( "VISU_FIELD_RANGE" ) );
2908 types.append( tr( "VISU_IMPOSED_RANGE" ) );
2910 indices.append( 0 );
2911 indices.append( 1 );
2912 setPreferenceProperty( rangetype, "strings", types );
2913 setPreferenceProperty( rangetype, "indexes", indices );
2915 int imposedGr = addPreference( tr( "VISU_MINMAX_IMPOSED_RANGE" ), sbarTab );
2917 int min = addPreference( tr( "VISU_MIN" ), imposedGr, LightApp_Preferences::DblSpin, "VISU", "scalar_range_min" );
2918 int max = addPreference( tr( "VISU_MAX" ), imposedGr, LightApp_Preferences::DblSpin, "VISU", "scalar_range_max" );
2919 setPreferenceProperty( min, "step", 0.1 );
2920 setPreferenceProperty( max, "step", 0.1 );
2923 int fontGr = addPreference( tr( "VISU_FONT" ), sbarTab );
2924 int tfont = addPreference( tr( "VISU_TITLE" ), fontGr,
2925 LightApp_Preferences::Font, "VISU", "scalar_bar_title_font" );
2926 addPreference( tr( "VISU_TITLE" ), fontGr,
2927 LightApp_Preferences::Color, "VISU", "scalar_bar_title_color" );
2928 int lfont = addPreference( tr( "VISU_LABELS" ), fontGr,
2929 LightApp_Preferences::Font, "VISU", "scalar_bar_label_font" );
2930 addPreference( tr( "VISU_LABELS" ), fontGr,
2931 LightApp_Preferences::Color, "VISU", "scalar_bar_label_color" );
2934 fam.append( tr( "VISU_FONT_ARIAL" ) );
2935 fam.append( tr( "VISU_FONT_COURIER" ) );
2936 fam.append( tr( "VISU_FONT_TIMES" ) );
2937 int wflag = ( QtxListResourceEdit::FontItem::All &
2938 ( ~( QtxListResourceEdit::FontItem::Size |
2939 QtxListResourceEdit::FontItem::UserSize ) ) );
2941 setPreferenceProperty( tfont, "families", fam );
2942 setPreferenceProperty( tfont, "system", false );
2943 setPreferenceProperty( tfont, "widget_flags", wflag );
2944 setPreferenceProperty( lfont, "families", fam );
2945 setPreferenceProperty( lfont, "system", false );
2946 setPreferenceProperty( lfont, "widget_flags", wflag );
2948 // group: "Colors & Labels"
2949 int colorsLabelsGr = addPreference( tr( "VISU_COLORS_AND_LABELS" ), sbarTab );
2951 int numcol = addPreference( tr( "VISU_NB_COLORS" ), colorsLabelsGr,
2952 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_num_colors" );
2953 setPreferenceProperty( numcol, "min", 2 );
2954 setPreferenceProperty( numcol, "max", 256 );
2956 int numlab = addPreference( tr( "VISU_NB_LABELS" ), colorsLabelsGr,
2957 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_num_labels" );
2958 setPreferenceProperty( numlab, "min", 2 );
2959 setPreferenceProperty( numlab, "max", 65 );
2961 // group: "Orientation"
2962 int orientGr = addPreference( tr( "VISU_ORIENTATION" ), sbarTab );
2963 int orient = addPreference( tr( "VISU_ORIENTATION" ), orientGr,
2964 LightApp_Preferences::Selector, "VISU", "scalar_bar_orientation" );
2965 QStringList orients;
2966 orients.append( tr( "VISU_VERTICAL" ) );
2967 orients.append( tr( "VISU_HORIZONTAL" ) );
2969 indices.append( 0 );
2970 indices.append( 1 );
2971 setPreferenceProperty( orient, "strings", orients );
2972 setPreferenceProperty( orient, "indexes", indices );
2974 // group: "Origin & Size Vertical"
2975 int posVSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_VERTICAL" ), sbarTab );
2976 int xv = addPreference( tr( "VISU_X" ), posVSizeGr,
2977 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_x" );
2978 int yv = addPreference( tr( "VISU_Y" ), posVSizeGr,
2979 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_y" );
2980 int wv = addPreference( tr( "VISU_WIDTH" ), posVSizeGr,
2981 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_width" );
2982 int hv = addPreference( tr( "VISU_HEIGHT" ), posVSizeGr,
2983 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_height" );
2984 setPreferenceProperty( xv, "step", 0.1 );
2985 setPreferenceProperty( yv, "step", 0.1 );
2986 setPreferenceProperty( wv, "step", 0.1 );
2987 setPreferenceProperty( hv, "step", 0.1 );
2988 setPreferenceProperty( xv, "min", 0.0 );
2989 setPreferenceProperty( yv, "min", 0.0 );
2990 setPreferenceProperty( wv, "min", 0.0 );
2991 setPreferenceProperty( hv, "min", 0.0 );
2992 setPreferenceProperty( xv, "max", 1.0 );
2993 setPreferenceProperty( yv, "max", 1.0 );
2994 setPreferenceProperty( wv, "max", 1.0 );
2995 setPreferenceProperty( hv, "max", 1.0 );
2997 // group: "Origin & Size Horizontal"
2998 int posHSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_HORIZONTAL" ), sbarTab );
2999 int xh = addPreference( tr( "VISU_X" ), posHSizeGr,
3000 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_x" );
3001 int yh = addPreference( tr( "VISU_Y" ), posHSizeGr,
3002 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_y" );
3003 int wh = addPreference( tr( "VISU_WIDTH" ), posHSizeGr,
3004 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_width" );
3005 int hh = addPreference( tr( "VISU_HEIGHT" ), posHSizeGr,
3006 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_height" );
3007 setPreferenceProperty( xh, "step", 0.1 );
3008 setPreferenceProperty( yh, "step", 0.1 );
3009 setPreferenceProperty( wh, "step", 0.1 );
3010 setPreferenceProperty( hh, "step", 0.1 );
3011 setPreferenceProperty( xh, "min", 0.0 );
3012 setPreferenceProperty( yh, "min", 0.0 );
3013 setPreferenceProperty( wh, "min", 0.0 );
3014 setPreferenceProperty( hh, "min", 0.0 );
3015 setPreferenceProperty( xh, "max", 1.0 );
3016 setPreferenceProperty( yh, "max", 1.0 );
3017 setPreferenceProperty( wh, "max", 1.0 );
3018 setPreferenceProperty( hh, "max", 1.0 );
3020 // group: "Scalar bars default position"
3021 int scalarBarGr = addPreference( tr( "Scalar bars default position" ), sbarTab );
3022 addPreference( tr( "Arrange Scalar Bars" ), scalarBarGr, LightApp_Preferences::Bool, "VISU", "scalar_bars_default_position" );
3024 int srangeTab = addPreference( tr( "Sweep, MED import" ) );
3026 // group: "Sweeping preferences"
3027 int sweepGr = addPreference( tr( "VISU_SWEEPING_PREF" ), srangeTab );
3028 setPreferenceProperty( sweepGr, "columns", 1 );
3030 int timestep = addPreference( tr( "VISU_TIME_STEP" ), sweepGr,
3031 LightApp_Preferences::DblSpin, "VISU", "sweeping_time_step" );
3032 int nbcycles = addPreference( tr( "VISU_NB_CYCLES" ), sweepGr,
3033 LightApp_Preferences::IntSpin, "VISU", "sweeping_number_cycles" );
3034 int nbsteps = addPreference( tr( "VISU_NB_STEPS" ), sweepGr,
3035 LightApp_Preferences::IntSpin, "VISU", "sweeping_number_steps" );
3036 setPreferenceProperty( timestep, "min", 0.1 );
3037 setPreferenceProperty( timestep, "step", 0.1 );
3038 setPreferenceProperty( timestep, "max", 1000 );
3039 setPreferenceProperty( nbcycles, "max", 100 );
3040 setPreferenceProperty( nbsteps, "max", 200 );
3042 // group: "MED files import"
3043 int importGr = addPreference( tr( "MED files import" ), srangeTab );
3044 setPreferenceProperty( importGr, "columns", 1 );
3045 addPreference( tr( "Use build progress" ), importGr, LightApp_Preferences::Bool, "VISU", "use_build_progress" );
3046 addPreference( tr( "Full MED loading" ), importGr, LightApp_Preferences::Bool, "VISU", "full_med_loading" );
3047 addPreference( tr( "Build at once" ), importGr, LightApp_Preferences::Bool, "VISU", "build_at_once" );
3048 addPreference( tr( "Build fields" ), importGr, LightApp_Preferences::Bool, "VISU", "build_fields" );
3049 addPreference( tr( "Build min/max" ), importGr, LightApp_Preferences::Bool, "VISU", "build_min_max" );
3050 addPreference( tr( "Build groups" ), importGr, LightApp_Preferences::Bool, "VISU", "build_groups" );
3051 addPreference( tr( "Close dialog at finish" ), importGr, LightApp_Preferences::Bool, "VISU", "close_at_finish" );
3053 // TAB: Representation ; group: "Representation properties"
3054 int representationTab = addPreference( tr( "Representation" ) );
3056 int representGr = addPreference( tr( "VISU_REPRESENT_PROPS" ), representationTab );
3058 QStringList mesh_modes;
3059 mesh_modes.append( "Points" );
3060 mesh_modes.append( "Wireframe" );
3061 mesh_modes.append( "Insideframe" );
3062 mesh_modes.append( "Surfaceframe" );
3063 mesh_modes.append( "Surface" );
3064 QValueList<QVariant> mesh_indices;
3065 mesh_indices.append( 0 );
3066 mesh_indices.append( 1 );
3067 mesh_indices.append( 3 );
3068 mesh_indices.append( 4 );
3069 mesh_indices.append( 2 );
3071 QStringList modes1 = mesh_modes;
3072 modes1.remove( "Surfaceframe" );
3073 QValueList<QVariant> indices1 = mesh_indices;
3074 indices1.remove( 4 );
3076 QStringList modes2 = modes1;
3077 modes2.remove( "Insideframe" );
3078 QValueList<QVariant> indices2 = indices1;
3079 indices2.remove( 3 );
3081 QStringList modes3 = modes2;
3082 modes3.remove( "Surface" );
3083 QValueList<QVariant> indices3 = indices2;
3084 indices3.remove( 2 );
3087 int mesh_represent = addPreference( tr( "VISU_MESH" ), representGr, LightApp_Preferences::Selector, "VISU", "mesh_represent" );
3088 setPreferenceProperty( mesh_represent, "strings", mesh_modes );
3089 setPreferenceProperty( mesh_represent, "indexes", mesh_indices );
3090 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "mesh_shrink" );
3092 int scalar_map_represent = addPreference( tr( "VISU_SCALAR_MAP" ), representGr, LightApp_Preferences::Selector, "VISU", "scalar_map_represent" );
3093 setPreferenceProperty( scalar_map_represent, "strings", modes1 );
3094 setPreferenceProperty( scalar_map_represent, "indexes", indices1 );
3095 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "scalar_map_shrink" );
3097 int iso_surfaces_represent = addPreference( tr( "VISU_ISO_SURFACES" ), representGr, LightApp_Preferences::Selector, "VISU", "iso_surfaces_represent" );
3098 setPreferenceProperty( iso_surfaces_represent, "strings", modes2 );
3099 setPreferenceProperty( iso_surfaces_represent, "indexes", indices2 );
3100 addPreference( "", representGr, LightApp_Preferences::Space );
3102 int cut_planes_represent = addPreference( tr( "VISU_CUT_PLANES" ), representGr, LightApp_Preferences::Selector, "VISU", "cut_planes_represent" );
3103 setPreferenceProperty( cut_planes_represent, "strings", modes2 );
3104 setPreferenceProperty( cut_planes_represent, "indexes", indices2 );
3105 addPreference( "", representGr, LightApp_Preferences::Space );
3107 int cut_lines_represent = addPreference( tr( "VISU_CUT_LINES" ), representGr, LightApp_Preferences::Selector, "VISU", "cut_lines_represent" );
3108 setPreferenceProperty( cut_lines_represent, "strings", modes3 );
3109 setPreferenceProperty( cut_lines_represent, "indexes", indices3 );
3110 addPreference( "", representGr, LightApp_Preferences::Space );
3112 int deformed_shape_represent = addPreference( tr( "VISU_DEFORMED_SHAPE" ), representGr, LightApp_Preferences::Selector, "VISU", "deformed_shape_represent" );
3113 setPreferenceProperty( deformed_shape_represent, "strings", modes1 );
3114 setPreferenceProperty( deformed_shape_represent, "indexes", indices1 );
3115 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "deformed_shape_shrink" );
3117 int vectors_represent = addPreference( tr( "VISU_VECTORS" ), representGr, LightApp_Preferences::Selector, "VISU", "vectors_represent" );
3118 setPreferenceProperty( vectors_represent, "strings", modes3 );
3119 setPreferenceProperty( vectors_represent, "indexes", indices3 );
3120 addPreference( "", representGr, LightApp_Preferences::Space );
3122 int stream_lines_represent = addPreference( tr( "VISU_STREAM_LINES" ), representGr, LightApp_Preferences::Selector, "VISU", "stream_lines_represent" );
3123 setPreferenceProperty( stream_lines_represent, "strings", modes3 );
3124 setPreferenceProperty( stream_lines_represent, "indexes", indices3 );
3125 addPreference( "", representGr, LightApp_Preferences::Space );
3127 int plot3d_represent = addPreference( tr( "VISU_PLOT3D" ), representGr, LightApp_Preferences::Selector, "VISU", "plot3d_represent" );
3128 setPreferenceProperty( plot3d_represent, "strings", modes2 );
3129 setPreferenceProperty( plot3d_represent, "indexes", indices2 );
3130 addPreference( "", representGr, LightApp_Preferences::Space );
3132 int scalar_def_represent = addPreference( tr( "VISU_SCALAR_MAP_ON_DEFORMED_SHAPE" ), representGr, LightApp_Preferences::Selector, "VISU", "scalar_def_represent" );
3133 setPreferenceProperty( scalar_def_represent, "strings", modes2 );
3134 setPreferenceProperty( scalar_def_represent, "indexes", indices2 );
3135 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "scalar_def_shrink" );
3137 addPreference( tr( "VISU_USE_SHADING" ), representGr,
3138 LightApp_Preferences::Bool, "VISU", "represent_shading" );
3141 void VisuGUI::preferencesChanged( const QString& a, const QString& b)
3143 if (a != QString("VISU")) return;
3144 if (b == QString("scalar_bar_orientation")) return;
3145 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
3146 float sbX1,sbY1,sbW,sbH;
3147 float aTol = 1.00000009999999;
3148 std::string aWarning;
3149 if(b == QString("scalar_bar_vertical_x") || b == QString("scalar_bar_vertical_width")){
3150 sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_x", sbX1);
3151 sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_width", sbW);
3152 if(sbX1+sbW > aTol){
3153 aWarning = "Origin and Size Vertical: X+Width > 1\n";
3156 aResourceMgr->setValue("VISU", "scalar_bar_vertical_x", sbX1);
3157 aResourceMgr->setValue("VISU", "scalar_bar_vertical_width", sbW);
3160 else if(b == QString("scalar_bar_vertical_y") || b == QString("scalar_bar_vertical_height")){
3161 sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_y", sbY1);
3162 sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_height",sbH);
3163 if(sbY1+sbH > aTol){
3164 aWarning = "Origin and Size Vertical: Y+Height > 1\n";
3167 aResourceMgr->setValue("VISU", "scalar_bar_vertical_y", sbY1);
3168 aResourceMgr->setValue("VISU", "scalar_bar_vertical_height",sbH);
3171 else if(b == QString("scalar_bar_horizontal_x") || b == QString("scalar_bar_horizontal_width")){
3172 sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_x", sbX1);
3173 sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_width", sbW);
3174 if(sbX1+sbW > aTol){
3175 aWarning = "Origin and Size Horizontal: X+Width > 1\n";
3178 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_x", sbX1);
3179 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_width", sbW);
3182 else if(b == QString("scalar_bar_horizontal_y") || b == QString("scalar_bar_horizontal_height")){
3183 sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_y", sbY1);
3184 sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_height",sbH);
3185 if(sbY1+sbH > aTol){
3186 aWarning = "Origin and Size Horizontal: Y+Height > 1\n";
3189 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_y", sbY1);
3190 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_height",sbH);
3193 if (aWarning.size() != 0){
3194 aWarning += "The default values are applied instead.";
3195 SUIT_MessageBox::warn1(GetDesktop(this),
3196 tr("ERR_SCALARBAR_PARAMS"),
3197 tr(aWarning.c_str()),
3204 ::getViewManager(const QString& theType,
3205 const bool theIsCreate)
3207 return getApp()->getViewManager(theType,theIsCreate);
3212 ::getScalarBarsMap()
3214 return myScalarBarsMap;
3216 LightApp_Displayer* VisuGUI::displayer()
3219 myDisplayer = new VisuGUI_Displayer( getApp() );
3225 void VisuGUI::OnPlot3dFromCutPlane()
3227 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
3228 if (CheckLock(aCStudy, GetDesktop(this)))
3231 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
3232 SALOME_ListIO aListIO;
3233 aSelectionMgr->selectedObjects(aListIO);
3235 if (aListIO.Extent() < 1) return;
3238 VISU::CutPlanes_i* aCutPrs = 0;
3239 Handle(SALOME_InteractiveObject) anIO;
3240 _PTR(SObject) aSObject;
3241 SALOME_ListIteratorOfListIO It (aListIO);
3242 for (; It.More(); It.Next()) {
3245 if (!anIO.IsNull() && anIO->hasEntry()) {
3246 aSObject = aCStudy->FindObjectID(anIO->getEntry());
3249 CORBA::Object_var anObject = GetSelectedObj(GetAppStudy(this), anIO->getEntry());
3250 if (!CORBA::is_nil(anObject)) {
3251 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
3252 if (aPrsObject->GetType() == VISU::TCUTPLANES) {
3253 aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
3262 _PTR(SObject) aTimeStampSObj = aSObject->GetFather();
3263 if (SUIT_ViewManager* aViewManager = getApp()->activeViewManager()) {
3264 QString aType = aViewManager->getType();
3265 bool isVVTK = aType == VVTK_Viewer::Type();
3267 Storable::TRestoringMap aMap = getMapOfValue(aTimeStampSObj);
3269 aType = Storable::FindValue(aMap,"myType",&isExist);
3270 if (!isExist || aType.toInt() != TTIMESTAMP )
3273 QString aMeshName = Storable::FindValue(aMap,"myMeshName",&isExist).latin1();
3274 QString anEntity = Storable::FindValue(aMap,"myEntityId",&isExist).latin1();
3275 QString aFieldName = Storable::FindValue(aMap,"myFieldName",&isExist).latin1();
3276 QString aTimeStampId = Storable::FindValue(aMap,"myTimeStampId",&isExist).latin1();
3279 SUIT_ViewWindow* aViewWindow = 0;
3281 aViewWindow = GetViewWindow<VVTK_Viewer>(this);
3282 aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast<VVTK_ViewWindow*>(aViewWindow));
3284 aViewWindow = GetViewWindow<SVTK_Viewer>(this);
3285 aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast<SVTK_ViewWindow*>(GetViewWindow<SVTK_Viewer>(this)));
3287 GetResourceMgr()->setValue("VISU", "scalar_bar_position_num", aPos);
3289 VISU::Plot3D_i* aPrs3d = CreatePrs3d<VISU::Plot3D_i>(this, aTimeStampSObj, aMeshName.latin1(), (Entity)anEntity.toInt(),
3290 aFieldName.latin1(), aTimeStampId.toInt());
3292 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
3293 int aValue = aResourceMgr->integerValue("VISU","BuildDefaultPrs3d",0);
3295 VisuGUI_Plot3DDlg* aDlg = new VisuGUI_Plot3DDlg(this);
3296 aDlg->initFromPrsObject(aPrs3d);
3297 int aOrient = aCutPrs->GetOrientationType(); // Plot3d has the same orientation type
3298 double aRotX = aCutPrs->GetRotateX();
3299 double aRotY = aCutPrs->GetRotateY();
3300 double aPlanePos = aCutPrs->GetPlanePosition(0);
3301 aDlg->setPlane(aOrient, aRotX, aRotY, aPlanePos);
3303 if (!(runAndWait(aDlg, 0) && (aDlg->storeToPrsObject(aPrs3d)))) {
3304 DeletePrs3d(this, aPrs3d, anIO);
3309 UpdateObjBrowser(this, true, aTimeStampSObj);
3311 SVTK_ViewWindow* aSVtkWindow = dynamic_cast<SVTK_ViewWindow*>(aViewWindow);
3312 if ( aSVtkWindow ) {
3313 PublishInView(this, aPrs3d, aSVtkWindow, /*highlight = */true);
3314 aSVtkWindow->onFitAll();
3316 AddScalarBarPosition(this, aSVtkWindow, aPrs3d, aPos);
3320 application()->putInfo(QObject::tr("INF_DONE"));