1 // VISU VISUGUI : GUI of VISU component
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
25 // Author : Laurent CORNABE
38 #include <qptrvector.h>
39 #include <qcolordialog.h>
42 #include <vtkRenderer.h>
43 #include <vtkRenderWindow.h>
44 #include <vtkActorCollection.h>
47 #include "SALOME_LifeCycleCORBA.hxx"
49 #include "SUIT_ResourceMgr.h"
50 #include "SUIT_MessageBox.h"
52 #include "SUIT_ViewWindow.h"
53 #include "SUIT_ViewManager.h"
55 #include "CAM_Module.h"
57 #include "SVTK_RenderWindow.h"
58 #include "SVTK_ViewWindow.h"
59 #include "SVTK_ViewModel.h"
60 #include "SVTK_Functor.h"
62 #include "SPlot2d_ViewModel.h"
63 #include "SPlot2d_SetupPlot2dDlg.h"
64 #include "Plot2d_SetupCurveDlg.h"
66 #include "OB_Browser.h"
68 #include "SALOME_ListIO.hxx"
69 #include "SALOME_ListIteratorOfListIO.hxx"
71 #include "SalomeApp_Application.h"
72 #include "SalomeApp_DataModel.h"
73 #include "SalomeApp_Study.h"
74 #include "SalomeApp_SelectionMgr.h"
75 #include "SalomeApp_Selection.h"
76 #include "SalomeApp_Preferences.h"
78 #include "QtxAction.h"
80 #include "VISUConfig.hh"
81 #include "VISU_Gen_i.hh"
82 #include "VISU_Mesh_i.hh"
83 #include "VISU_Table_i.hh"
84 #include "VISU_Result_i.hh"
85 #include "VISU_View_i.hh"
86 #include "VISU_ViewManager_i.hh"
87 #include "VISU_Plot3D_i.hh"
89 #include "VISU_Actor.h"
91 #include "VisuGUI_Prs3dTools.h"
92 #include "VisuGUI_Tools.h"
94 #include "VisuGUI_PopupTools.h"
95 #include "VisuGUI_NameDlg.h"
96 #include "VisuGUI_FileDlg.h"
97 #include "VisuGUI_CursorDlg.h"
98 #include "VisuGUI_Selection.h"
99 #include "VisuGUI_TimeAnimation.h"
100 #include "VisuGUI_EditContainerDlg.h"
101 #include "VisuGUI_NonIsometricDlg.h"
102 #include "VisuGUI_ClippingDlg.h"
103 #include "VisuGUI_Plot3DDlg.h"
104 #include "VisuGUI_CubeAxesDlg.h"
105 #include "VisuGUI_OffsetDlg.h"
107 #include "VISU_ScalarMap_i.hh"
108 #include "VisuGUI_ScalarBarDlg.h"
110 #include "VISU_DeformedShape_i.hh"
111 #include "VisuGUI_DeformedShapeDlg.h"
113 #include "VISU_IsoSurfaces_i.hh"
114 #include "VisuGUI_IsoSurfacesDlg.h"
116 #include "VISU_CutPlanes_i.hh"
117 #include "VisuGUI_CutPlanesDlg.h"
119 #include "VISU_CutLines_i.hh"
120 #include "VisuGUI_CutLinesDlg.h"
122 #include "VISU_StreamLines_i.hh"
123 #include "VisuGUI_StreamLinesDlg.h"
125 #include "VISU_Vectors_i.hh"
126 #include "VisuGUI_VectorsDlg.h"
128 #include "VisuGUI_TableDlg.h"
130 #include "SALOMEconfig.h"
131 #include CORBA_SERVER_HEADER(MED_Gen)
133 #include "utilities.h"
135 #include "VisuGUI_ActionsDef.h"
137 using namespace VISU;
140 static int MYDEBUG = 1;
142 static int MYDEBUG = 0;
145 //////////////////////////////////////////////////
147 //////////////////////////////////////////////////
150 SalomeApp_Module( "VISU" )
164 if(MYDEBUG) MESSAGE("VisuGUI::OnImportFromFile()");
165 CheckLock(GetCStudy(GetAppStudy(this)));
166 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
169 aFilter.append( tr("FLT_MED_FILES") );
170 aFilter.append( tr("FLT_ALL_FILES") );
172 QFileInfo aFileInfo =
173 SUIT_FileDlg::getFileName(GetDesktop(this),
176 tr("MEN_IMPORT_FROM_FILE"),
178 if(aFileInfo.exists()) {
179 application()->putInfo( "Importing From File " + aFileInfo.filePath() + "..." );
181 VISU::Result_var aResult;
182 bool anIsBuild = aResourceMgr->booleanValue("VISU", "full_med_loading", false);
183 if (VisuGUI_FileDlg::IsBuild) {
184 aResult = GetVisuGen(this)->ImportFile(aFileInfo.filePath());
185 if (!CORBA::is_nil(aResult.in()))
186 if (Result_i* aRes = dynamic_cast<Result_i*>(GetServant(aResult).in())) {
187 if (!aRes->IsPossible())
188 SUIT_MessageBox::warn1(GetDesktop(this),
190 tr("ERR_CANT_BUILD_PRESENTATION"),
196 aResourceMgr->setValue("VISU", "full_med_loading", false);
197 aResult = GetVisuGen(this)->ImportFile(aFileInfo.filePath());
198 aResourceMgr->setValue("VISU", "full_med_loading", anIsBuild);
201 if (CORBA::is_nil(aResult.in())) {
202 SUIT_MessageBox::warn1(GetDesktop(this),
204 tr("ERR_ERROR_IN_THE_FILE"),
207 application()->putInfo(aFileInfo.filePath() + tr("INF_DONE"));
208 UpdateObjBrowser(this);
218 if(MYDEBUG) MESSAGE("VisuGUI::OnExploreMEDFile()");
219 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
222 SALOME_MED::MED_Gen_var aGen = GetMEDEngine();
225 aFilter.append( tr("FLT_MED_FILES") );
226 aFilter.append( tr("FLT_ALL_FILES") );
228 QFileInfo aFileInfo =
229 SUIT_FileDlg::getFileName(GetDesktop(this),
232 tr("MEN_EXPLORE_MED_FILE"),
234 if(aFileInfo.exists()){
235 application()->putInfo( tr("MEN_EXPLORE_MED_FILE") + " " + aFileInfo.filePath() + "..." );
236 std::string aStudyName = aStudy->Name();
239 aGen->readStructFileWithFieldType(aFileInfo.filePath(),aStudyName.c_str());
243 SUIT_MessageBox::warn1(GetDesktop(this),
245 tr("ERR_ERROR_IN_THE_FILE"),
248 application()->putInfo(aFileInfo.filePath()+tr("INF_DONE"));
249 getApp()->updateObjectBrowser(true); // as need to update MED tree
250 getApp()->updateActions();
257 OnImportTableFromFile()
259 if(MYDEBUG) MESSAGE("VisuGUI::OnImportTableFromFile()");
260 CheckLock(GetCStudy(GetAppStudy(this)));
263 aFilter.append( tr("FLT_TABLE_FILES") );
264 aFilter.append( tr("FLT_ALL_FILES") );
266 QFileInfo aFileInfo =
267 SUIT_FileDlg::getFileName(GetDesktop(this),
270 tr("MEN_IMPORT_TABLE"),
272 if (aFileInfo.exists()) {
273 application()->putInfo( tr("MEN_IMPORT_TABLE") + " " + aFileInfo.filePath() + " ..." );
275 CORBA::Object_var anObject = GetVisuGen(this)->ImportTables(aFileInfo.filePath());
277 if (CORBA::is_nil(anObject.in())) {
278 SUIT_MessageBox::warn1(GetDesktop(this),
280 tr("ERR_ERROR_IN_THE_FILE"),
283 application()->putInfo(aFileInfo.filePath()+tr("INF_DONE"));
284 UpdateObjBrowser(this);
291 OnExportTableToFile()
293 if(MYDEBUG) MESSAGE("VisuGUI::OnExportTableToFile()");
295 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
297 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
298 SALOME_ListIO aListIO;
299 aSelectionMgr->selectedObjects(aListIO);
301 if (aListIO.Extent() > 0) {
302 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
303 if (anIO->hasEntry()) {
304 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
307 // find table attribute
309 _PTR(GenericAttribute) anAttr;
311 if (!aSObj->FindAttribute(anAttr, "AttributeTableOfReal")) {
313 if (!aSObj->FindAttribute(anAttr, "AttributeTableOfInteger")) {
314 // if the current SObject is a table title
315 // we take a father contaning the table
316 aSObj = aSObj->GetFather();
318 if (aSObj->FindAttribute(anAttr, "AttributeTableOfReal")) {
321 if (!aSObj->FindAttribute(anAttr, "AttributeTableOfInteger")) {
328 // get table title in order to have default name of the file
331 _PTR(AttributeTableOfReal) aTabAttr (anAttr);
332 if (!aTabAttr) return;
333 aTitle = aTabAttr->GetTitle().c_str();
335 _PTR(AttributeTableOfInteger) aTabAttr (anAttr);
336 if (!aTabAttr) return;
337 aTitle = aTabAttr->GetTitle().c_str();
339 aTitle.simplifyWhiteSpace();
340 aTitle = aTitle.replace(QRegExp(" "), "_");
342 // get default path for the file
343 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
344 QString aDir = aResourceMgr->stringValue("VISU","OutputDir","");
345 if (aDir.isEmpty()) {
346 aDir = aResourceMgr->stringValue("VISU","InputDir","");
347 if (aDir.isEmpty()) {
348 aDir = getenv("CSF_PATHData");
351 QString aPath = Qtx::addSlash(aDir) + aTitle;
353 // get name for the file
355 aFilter.append("Table Files (*.xls)");
357 QFileInfo aFileInfo =
358 SUIT_FileDlg::getFileName(GetDesktop(this),
361 tr("MEN_EXPORT_TABLE"), // "Export Table To File"
365 QString aFile = aFileInfo.filePath();
366 if (!aFile.isEmpty()) {
367 application()->putInfo(tr("MEN_EXPORT_TABLE") + " " + aFile + " ...");
368 aDir = Qtx::dir(aFile, true);
369 aResourceMgr->setValue("VISU", "OutputDir", aDir);
372 GetVisuGen(this)->ExportTableToFile(GetSObject(aSObj), aFile.latin1());
373 application()->putInfo(aFile + " " + tr("INF_DONE"));
374 } catch(std::exception& ex) {
376 SUIT_MessageBox::warn1(GetDesktop(this),
378 tr("ERR_ERROR_DURING_EXPORT") + " " + tr(ex.what()),
381 INFOS(tr("ERR_ERROR_DURING_EXPORT"));
382 SUIT_MessageBox::warn1(GetDesktop(this),
384 tr("ERR_ERROR_DURING_EXPORT"),
396 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
397 if (CheckLock(aCStudy))
399 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
401 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
402 SALOME_ListIO aListIO;
403 aSelectionMgr->selectedObjects(aListIO);
405 SALOME_ListIteratorOfListIO It (aListIO);
406 QApplication::setOverrideCursor(Qt::waitCursor);
407 for (; It.More(); It.Next()) {
408 Handle(SALOME_InteractiveObject) anIO = It.Value();
409 SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
410 if (!aSObject->_is_nil()) {
411 CORBA::Object_var anObject = VISU::SObjectToObject(aSObject);
412 if (!CORBA::is_nil(anObject)) {
413 SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
414 if (!CORBA::is_nil(aMED.in()))
415 GetVisuGen(this)->ImportMed(aSObject);
416 SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject);
417 if (!CORBA::is_nil(aField.in()))
418 GetVisuGen(this)->ImportMedField(aField);
420 SALOMEDS::SObject_var aSFather = aSObject->GetFather();
421 SALOMEDS::GenericAttribute_var anAttr;
422 aSFather->FindAttribute(anAttr, "AttributeName");
423 SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
424 CORBA::String_var aValue = aName->Value();
425 if (strcmp(aValue.in(), "MEDFIELD") == 0)
426 GetVisuGen(this)->ImportMed(aSObject);
430 UpdateObjBrowser(this, true);
431 QApplication::restoreOverrideCursor();
435 CreateCurves( SalomeApp_Module* theModule,
436 VISU::CutLines_i* thePrs,
438 const bool theCreate = true )
442 VisuGUI_CutLinesDlg* aCutDlg = dynamic_cast<VisuGUI_CutLinesDlg*>( theDlg );
446 _PTR(Study) aStudy = GetCStudy( GetAppStudy( theModule ) );
447 _PTR(SObject) aSObject = aStudy->FindObjectID( thePrs->GetEntry().latin1() );
449 if ( !theCreate && aSObject ) {
451 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
452 _PTR(ChildIterator) aIter = aStudy->NewChildIterator(aSObject);
453 for (; aIter->More(); aIter->Next()) {
454 _PTR(SObject) aTblObj = aIter->Value();
456 _PTR(GenericAttribute) anAttr;
457 if (aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
458 aBuilder->RemoveObjectWithChildren( aIter->Value() ); // We should have only one child
465 if ( aCutDlg->isGenerateTable() ) {
466 GetVisuGen( theModule )->CreateTable( thePrs->GetEntry() );
467 if ( aCutDlg->isGenerateCurves() ) {
469 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
470 _PTR(ChildIterator) aIter = aStudy->NewChildIterator(aSObject);
471 for (; aIter->More(); aIter->Next()) {
472 _PTR(SObject) aTblObj = aIter->Value();
474 _PTR(GenericAttribute) anAttr;
475 if ( aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
476 CreatePlot( theModule, aTblObj );
484 if (!theCreate && aSObject) {
485 UpdateObjBrowser(theModule);
493 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
494 if (CheckLock(aStudy))
497 // Get selected SObject
498 Handle(SALOME_InteractiveObject) anIO;
499 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
500 if (anIO.IsNull() || !anIO->hasEntry())
503 // create a VTK view window if it does not exist
504 GetViewWindow( this, /*create=*/true );
506 CreateMesh(this, anIO);
513 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
514 if (CheckLock(aStudy))
517 // create a VTK view window if it does not exist
518 GetViewWindow( this, /*create=*/true );
520 // Get selected SObject
521 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
522 SALOME_ListIO aListIO;
523 aSelectionMgr->selectedObjects(aListIO);
524 SALOME_ListIteratorOfListIO anIter (aListIO);
525 for (; anIter.More(); anIter.Next()) {
526 Handle(SALOME_InteractiveObject) anIO = anIter.Value();
527 if (anIO.IsNull() || !anIO->hasEntry())
530 CreateMesh(this, anIO);
538 CreatePrs3d<VISU::ScalarMap_i,VisuGUI_ScalarBarDlg,1>(this);
544 OnCreateDeformedShape()
546 CreatePrs3d<VISU::DeformedShape_i,VisuGUI_DeformedShapeDlg,1>(this);
553 CreatePrs3d<VISU::Vectors_i,VisuGUI_VectorsDlg,1>(this);
558 OnCreateIsoSurfaces()
560 CreatePrs3d<VISU::IsoSurfaces_i,VisuGUI_IsoSurfacesDlg,1>(this);
567 CreatePrs3d<VISU::CutPlanes_i,VisuGUI_CutPlanesDlg,0>(this);
574 CreatePrs3d<VISU::CutLines_i,VisuGUI_CutLinesDlg,0>(this);
579 OnCreateStreamLines()
581 CreatePrs3d<VISU::StreamLines_i,VisuGUI_StreamLinesDlg,1>(this);
588 CreatePrs3d<VISU::Plot3D_i,VisuGUI_Plot3DDlg,0>(this);
595 CheckLock(GetCStudy(GetAppStudy(this)));
596 GetVisuGen( this )->CreateContainer();
597 UpdateObjBrowser(this);
604 if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs");
606 QApplication::setOverrideCursor(Qt::waitCursor);
608 SalomeApp_SelectionMgr* mgr = GetSelectionMgr(this);
609 mgr->selectedObjects(aList);
611 Handle(SALOME_InteractiveObject) anIO;
612 for ( SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next() ) {
614 CORBA::Object_var anObject = GetSelectedObj( GetAppStudy(this), anIO->getEntry() );
615 if ( !CORBA::is_nil( anObject ) ) {
616 // is it Prs3d object ?
617 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
619 if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs : Prs3d object");
620 UpdateViewer( this, aPrsObject );
621 SVTK_ViewWindow* vw = GetViewWindow( this, /*create=*/true );
623 vw->highlight(anIO, 1);
628 VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(anObject).in());
630 if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs : Curve object");
631 PlotCurve( this, aCurve, VISU::eDisplay );
635 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(anObject).in());
637 if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Container object");
638 PlotContainer( this, aContainer, VISU::eDisplay );
642 VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(anObject).in());
644 if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Table object");
645 PlotTable( this, aTable, VISU::eDisplay );
650 SVTK_ViewWindow* vw = GetViewWindow( this );
652 vw->getRenderer()->ResetCameraClippingRange();
655 QApplication::restoreOverrideCursor();
670 if(MYDEBUG) MESSAGE("OnErasePrs");
672 QApplication::setOverrideCursor(Qt::waitCursor);
674 SVTK_ViewWindow* vw = GetViewWindow( this );
676 vw->unHighlightAll();
679 SalomeApp_SelectionMgr* mgr = GetSelectionMgr(this);
680 mgr->selectedObjects(aList);
682 Handle(SALOME_InteractiveObject) anIO;
683 for ( SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next() ) {
685 CORBA::Object_var anObject = GetSelectedObj( GetAppStudy(this), anIO->getEntry() );
686 ErasePrs( this, anObject, false );
692 QApplication::restoreOverrideCursor();
700 Handle(SALOME_InteractiveObject) anIO;
701 if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
702 EditPrs3d<VISU::ScalarMap_i, VisuGUI_ScalarBarDlg,1>(this, aPrs3d);
703 if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
704 aViewWindow->highlight(anIO, 1);
712 OnEditDeformedShape()
714 Handle(SALOME_InteractiveObject) anIO;
715 if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
716 EditPrs3d<VISU::DeformedShape_i, VisuGUI_DeformedShapeDlg,1>(this, aPrs3d);
717 if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
718 aViewWindow->highlight(anIO, 1);
728 Handle(SALOME_InteractiveObject) anIO;
729 if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
730 EditPrs3d<VISU::CutPlanes_i, VisuGUI_CutPlanesDlg,0>(this, aPrs3d);
731 if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
732 aViewWindow->highlight(anIO, 1);
742 Handle(SALOME_InteractiveObject) anIO;
743 if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
744 EditPrs3d<VISU::CutLines_i, VisuGUI_CutLinesDlg,0>(this, aPrs3d);
745 if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
746 aViewWindow->highlight(anIO, 1);
756 Handle(SALOME_InteractiveObject) anIO;
757 if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
758 EditPrs3d<VISU::IsoSurfaces_i, VisuGUI_IsoSurfacesDlg,1>(this, aPrs3d);
759 if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
760 aViewWindow->highlight(anIO, 1);
770 Handle(SALOME_InteractiveObject) anIO;
771 if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
772 EditPrs3d<VISU::Vectors_i, VisuGUI_VectorsDlg,1>(this, aPrs3d);
773 if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
774 aViewWindow->highlight(anIO, 1);
784 Handle(SALOME_InteractiveObject) anIO;
785 if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
786 EditPrs3d<VISU::StreamLines_i, VisuGUI_StreamLinesDlg,1>(this, aPrs3d);
787 if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
788 aViewWindow->highlight(anIO, 1);
798 Handle(SALOME_InteractiveObject) anIO;
799 if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
800 EditPrs3d<VISU::Plot3D_i, VisuGUI_Plot3DDlg,0>(this, aPrs3d);
801 if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
802 aViewWindow->highlight(anIO, 1);
812 if (SVTK_ViewWindow* vw = GetViewWindow()) {
813 vw->unHighlightAll();
814 if (vtkRenderer *aRen = vw->getRenderer()) {
816 vtkActorCollection *anActColl = aRen->GetActors();
817 for (anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ) {
818 if (anActor->GetVisibility() > 0)
819 if (VISU_Actor* anVISUActor = VISU_Actor::SafeDownCast(anActor)) {
820 anVISUActor = anVISUActor->GetParent();
821 anVISUActor->VisibilityOff();
826 } else if (SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(this, false)) {
835 ChangeRepresentation(this, VISU::SURFACEFRAME);
842 ChangeRepresentation(this, VISU::INSIDEFRAME);
849 ChangeRepresentation(this, VISU::WIREFRAME);
856 ChangeRepresentation(this, VISU::SHADED);
863 ChangeRepresentation(this, VISU::POINT);
870 ChangeRepresentation(this, VISU::SHRINK);
877 Handle(SALOME_InteractiveObject) anIO;
878 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
879 if (CORBA::is_nil(anObject)) return;
880 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
881 if (!aServant.in()) return;
883 VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
886 SVTK_ViewWindow* vw = GetViewWindow();
889 VISU_Actor* anActor = GetActor(aPrs3d, vw);
890 if (!anActor) return;
892 VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
893 VISU::DeformedShape_i* aDeformedShape = dynamic_cast<VISU::DeformedShape_i*>(aPrs3d);
894 SALOMEDS::Color anOldColor, aNewColor;
895 int aRepresent = anActor->GetRepresentation();
897 switch (aRepresent) {
899 anOldColor = aMesh->GetNodeColor();
901 case VISU::WIREFRAME :
902 case VISU::INSIDEFRAME :
903 anOldColor = aMesh->GetLinkColor();
906 case VISU::SURFACEFRAME :
907 anOldColor = aMesh->GetCellColor();
910 } else if (aDeformedShape) {
911 anOldColor = aDeformedShape->GetColor();
916 QColor aColor (int(255*anOldColor.R),
917 int(255*anOldColor.G),
918 int(255*anOldColor.B));
919 QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
920 if (aColorNew.isValid()) {
921 aNewColor.R = aColorNew.red()/255.;
922 aNewColor.G = aColorNew.green()/255.;
923 aNewColor.B = aColorNew.blue()/255.;
925 switch (aRepresent) {
927 aMesh->SetNodeColor(aNewColor);
929 case VISU::WIREFRAME :
930 case VISU::INSIDEFRAME :
931 aMesh->SetLinkColor(aNewColor);
934 case VISU::SURFACEFRAME :
935 aMesh->SetCellColor(aNewColor);
939 aDeformedShape->SetColor(aNewColor);
941 RecreateActor(this, aPrs3d);
947 OnChangeWireframeColor()
949 Handle(SALOME_InteractiveObject) anIO;
950 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
951 if (CORBA::is_nil(anObject)) return;
952 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
953 if (!aServant.in()) return;
955 VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
958 SVTK_ViewWindow* vw = GetViewWindow();
961 VISU_Actor* anActor = GetActor(aPrs3d, vw);
962 if (!anActor) return;
964 if (VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d)) {
965 SALOMEDS::Color anOldColor = aMesh->GetLinkColor(), aNewColor;
966 QColor aColor (int(255*anOldColor.R),
967 int(255*anOldColor.G),
968 int(255*anOldColor.B));
969 QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
970 if (aColorNew.isValid()) {
971 aNewColor.R = aColorNew.red()/255.;
972 aNewColor.G = aColorNew.green()/255.;
973 aNewColor.B = aColorNew.blue()/255.;
974 aMesh->SetLinkColor(aNewColor);
975 RecreateActor(this, aMesh);
984 Handle(SALOME_InteractiveObject) anIO;
985 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
986 if (CORBA::is_nil(anObject)) return;
987 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
988 if (!aServant.in()) return;
990 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
991 if (!aPrsObject) return;
993 SVTK_ViewWindow* vw = GetViewWindow();
996 VISU_Actor* anActor = GetActor(aPrsObject, vw);
997 if (!anActor) return;
999 VisuGUI_CursorDlg* CursorDlg =
1000 new VisuGUI_CursorDlg (GetDesktop(this), tr("DLG_OPACITY_TITLE"), TRUE);
1002 CursorDlg->Comment1->setText(tr("DLG_OPACITY_CMT1"));
1003 CursorDlg->Comment2->setText(tr("DLG_OPACITY_CMT2"));
1004 CursorDlg->SpinBox1->setMinValue(0);
1005 CursorDlg->SpinBox1->setMaxValue(100);
1007 float oldopac = anActor->GetOpacity();
1008 int intopac = int(oldopac*100. + 0.5);
1009 CursorDlg->SpinBox1->setValue(intopac);
1011 int ret = CursorDlg->exec();
1013 intopac = CursorDlg->SpinBox1->value();
1014 float newopac = intopac/100.;
1015 anActor->SetOpacity(newopac);
1024 Handle(SALOME_InteractiveObject) anIO;
1025 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1026 if (CORBA::is_nil(anObject)) return;
1027 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1028 if (!aServant.in()) return;
1030 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
1031 if (!aPrsObject) return;
1033 SVTK_ViewWindow* vw = GetViewWindow();
1036 VISU_Actor* anActor = GetActor(aPrsObject, vw);
1037 if (!anActor) return;
1039 VisuGUI_CursorDlg* CursorDlg =
1040 new VisuGUI_CursorDlg (GetDesktop(this), tr("DLG_LINEWIDTH_TITLE"), TRUE);
1042 CursorDlg->Comment1->setText(tr("DLG_LINEWIDTH_CMT1"));
1043 CursorDlg->Comment2->setText(tr("DLG_LINEWIDTH_CMT2"));
1044 CursorDlg->SpinBox1->setMinValue(1);
1045 CursorDlg->SpinBox1->setMaxValue(10);
1047 float oldlwid = anActor->GetLineWidth();
1048 int intlwid = int(oldlwid);
1049 CursorDlg->SpinBox1->setValue(intlwid);
1051 int ret = CursorDlg->exec();
1053 intlwid = CursorDlg->SpinBox1->value();
1054 float newlwid = intlwid;
1055 anActor->SetLineWidth(newlwid);
1064 Handle(SALOME_InteractiveObject) anIO;
1065 CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
1067 if ( !CORBA::is_nil( anObject ) ) {
1068 VISU::Base_var aVisuObj = VISU::Base::_narrow( anObject );
1069 if ( !CORBA::is_nil( aVisuObj ) && aVisuObj->GetType() == VISU::TTABLE ) {
1070 CORBA::Object_ptr aTable = VISU::Table::_narrow( anObject );
1071 if( !CORBA::is_nil( aTable ) ) {
1072 VISU::Table_i* table = dynamic_cast<VISU::Table_i*>( VISU::GetServant(aTable).in() );
1074 SO = GetCStudy( GetAppStudy( this ) )->FindObjectID( table->GetObjectEntry() );
1079 // possibly this is Table SObject
1080 SO = GetCStudy( GetAppStudy( this ) )->FindObjectID( anIO->getEntry() );
1083 if( !IsSObjectTable( SO ) )
1086 VisuGUI_TableDlg* dlg = new VisuGUI_TableDlg( GetDesktop( this ),
1089 //SAL2670 Orientation of show tables
1090 VisuGUI_TableDlg::ttAuto,
1099 Handle(SALOME_InteractiveObject) anIO;
1100 CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
1101 _PTR(Study) aStudy = GetCStudy( GetAppStudy( this ) );
1102 _PTR(SObject) aSObject = aStudy->FindObjectID(anIO->getEntry());
1103 VISU::CutLines_var aCutLines = VISU::CutLines::_narrow( anObject );
1104 if(!aCutLines->_is_nil() || IsSObjectTable(aSObject)) {
1105 GetVisuGen( this )->CreateTable( aSObject->GetID().c_str() );
1106 UpdateObjBrowser(this);
1114 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1115 if (CheckLock(aCStudy))
1118 SALOME_ListIO aList;
1119 SalomeApp_SelectionMgr* mgr = GetSelectionMgr(this);
1120 mgr->selectedObjects(aList,QString::null,false);
1121 int i = 0, nbSelected = aList.Extent();
1122 if (nbSelected < 1) return;
1124 const char* entries [nbSelected];
1125 Handle(SALOME_InteractiveObject) anIO;
1126 for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
1128 if (anIO->hasEntry())
1129 entries[i++] = anIO->getEntry();
1132 if (nbSelected < 1) return;
1134 // There is a transaction
1135 _PTR(StudyBuilder) aStudyBuilder = aCStudy->NewBuilder();
1136 aStudyBuilder->NewCommand();
1138 for (i = 0; i < nbSelected; i++) {
1139 _PTR(SObject) aSObject = aCStudy->FindObjectID(entries[i]);
1141 DeleteSObject(this, aCStudy, aSObject);
1145 // Finish transaction
1146 aStudyBuilder->CommitCommand();
1148 //GetActiveStudy()->unHighlightAll();
1149 UpdateObjBrowser(this, true);
1156 Handle(SALOME_InteractiveObject) anIO;
1157 CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
1159 _PTR(GenericAttribute) anAttr;
1160 _PTR(AttributeName) aName;
1162 _PTR(Study) aStudy = GetCStudy( GetAppStudy( this ) );
1164 if ( !CORBA::is_nil( anObject ) ) {
1165 VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
1166 if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TTABLE) {
1167 // Table (VISU object) is selected
1168 CORBA::Object_ptr aTbl = VISU::Table::_narrow( anObject );
1169 if( !CORBA::is_nil( aTbl ) ) {
1170 VISU::Table_i* table = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTbl).in());
1172 _PTR(SObject) SO = aStudy->FindObjectID( table->GetObjectEntry() );
1173 if ( IsSObjectTable(SO) ) {
1174 // get name of SObject
1175 if ( SO->FindAttribute( anAttr, "AttributeName" ) ) {
1177 SOName = QString( aName->Value().c_str() );
1179 SPlot2d_SetupPlot2dDlg* dlg = new SPlot2d_SetupPlot2dDlg( SO, GetDesktop( this ) );
1180 if ( dlg->exec() == QDialog::Accepted ) {
1181 if ( !IsStudyLocked( aStudy ) ) {
1182 // if study is not locked - create new container, create curves and insert them
1183 // into container, then plot container if current viewer is of VIEW_PLOT2D type
1185 QValueList<int> verIndices;
1186 dlg->getCurvesSource( horIndex, verIndices );
1187 if ( horIndex >= 0 && verIndices.count() > 0 ) {
1188 CORBA::Object_var aContainer = GetVisuGen(this)->CreateContainer();
1189 if( !CORBA::is_nil( aContainer ) ) {
1190 VISU::Container_i* pContainer =
1191 dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
1193 for ( int i = 0; i < verIndices.count(); i++ ) {
1194 CORBA::Object_var aNewCurve =
1195 GetVisuGen(this)->CreateCurve( table->_this(), horIndex+1, verIndices[i]+1 );
1196 if( !CORBA::is_nil( aNewCurve ) ) {
1197 VISU::Curve_i* pCrv =
1198 dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aNewCurve).in());
1201 int marker, line, lineWidth;
1203 if ( dlg->getCurveAttributes(verIndices[i], isAuto, marker,
1204 line, lineWidth, color) && !isAuto ) {
1206 c.R = color.red() /255.;
1207 c.G = color.green()/255.;
1208 c.B = color.blue() /255.;
1209 pCrv->SetColor( c );
1210 pCrv->SetMarker( ( VISU::Curve::MarkerType )marker );
1211 pCrv->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1213 pContainer->AddCurve( pCrv->_this() );
1217 UpdateObjBrowser(this);
1218 PlotContainer( this, pContainer, VISU::eDisplay );
1224 // if study is locked just get curves info and plot them
1225 // if current viewer is of VIEW_PLOT2D type
1226 QPtrList<Plot2d_Curve> container;
1227 dlg->getCurves( container );
1228 if ( !container.isEmpty() ) {
1229 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
1230 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( SOName );
1240 else if ( !anIO.IsNull() ) {
1241 // check if Table SObject is selected
1242 SO = aStudy->FindObjectID( anIO->getEntry() );
1243 if ( IsSObjectTable(SO) ) {
1244 // get name of SObject
1245 if ( SO->FindAttribute( anAttr, "AttributeName" ) ) {
1247 SOName = QString( aName->Value().c_str() );
1249 SPlot2d_SetupPlot2dDlg* dlg = new SPlot2d_SetupPlot2dDlg( SO, GetDesktop( this ) );
1250 if ( dlg->exec() == QDialog::Accepted ) {
1251 if ( !IsStudyLocked( aStudy ) ) {
1252 // if study is not locked - create new table and container objects, create curves
1253 // and insert them into container, then plot container if current viewer is of VIEW_PLOT2D type
1255 QValueList<int> verIndices;
1256 dlg->getCurvesSource( horIndex, verIndices );
1257 if ( horIndex >= 0 && verIndices.count() > 0 ) {
1258 CORBA::Object_var aTable = GetVisuGen(this)->CreateTable( SO->GetID().c_str() );
1259 CORBA::Object_var aContainer = GetVisuGen(this)->CreateContainer();
1260 if ( !CORBA::is_nil( aTable ) && !CORBA::is_nil( aContainer ) ) {
1261 VISU::Table_i* pTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTable).in());
1262 VISU::Container_i* pContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
1264 if ( pContainer && pTable ) {
1265 for ( int i = 0; i < verIndices.count(); i++ ) {
1266 CORBA::Object_var aNewCurve = GetVisuGen(this)->CreateCurve
1267 ( pTable->_this(), horIndex+1, verIndices[i]+1 );
1268 if( !CORBA::is_nil( aNewCurve ) ) {
1269 VISU::Curve_i* pCrv = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aNewCurve).in());
1272 int marker, line, lineWidth;
1274 if ( dlg->getCurveAttributes(verIndices[i], isAuto, marker,
1275 line, lineWidth, color) && !isAuto ) {
1277 c.R = color.red()/255.;
1278 c.G = color.green()/255.;
1279 c.B = color.blue()/255.;
1280 pCrv->SetColor( c );
1281 pCrv->SetMarker( ( VISU::Curve::MarkerType )marker );
1282 pCrv->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1284 pContainer->AddCurve( pCrv->_this() );
1288 UpdateObjBrowser(this);
1289 PlotContainer( this, pContainer, VISU::eDisplay );
1294 // if study is locked just get curves info and plot them
1295 QPtrList<Plot2d_Curve> container;
1296 dlg->getCurves( container );
1297 if ( !container.isEmpty() ) {
1298 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
1299 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( SOName );
1312 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1313 SALOME_ListIO aListIO;
1314 aSelectionMgr->selectedObjects(aListIO);
1315 if (aListIO.Extent() != 1) return;
1317 SalomeApp_Study* aAppStudy = GetAppStudy(this);
1318 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1319 CORBA::Object_var anObject = GetSelectedObj( aAppStudy, anIO->getEntry() );
1320 if (CORBA::is_nil( anObject )) return;
1322 VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
1323 if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TCURVE) {
1325 CORBA::Object_ptr aCurve = VISU::Curve::_narrow( anObject );
1326 if( !CORBA::is_nil( aCurve ) ) {
1327 VISU::Curve_i* aDSCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
1328 if ( aDSCurve && (!IsStudyLocked( GetCStudy(aAppStudy) )) ) {
1329 Plot2d_SetupCurveDlg aDlg(GetDesktop( this ));
1331 aDlg.setLine( (int)aDSCurve->GetLine(), aDSCurve->GetLineWidth() );
1332 aDlg.setMarker( (int)aDSCurve->GetMarker() );
1333 SALOMEDS::Color aColor = aDSCurve->GetColor();
1334 aDlg.setColor( QColor( (int)(aColor.R*255.), (int)(aColor.G*255.), (int)(aColor.B*255.) ) );
1335 if( aDlg.exec() == QDialog::Accepted ) {
1336 aDSCurve->SetLine( (VISU::Curve::LineType)aDlg.getLine(), aDlg.getLineWidth() );
1337 aDSCurve->SetMarker( (VISU::Curve::MarkerType)aDlg.getMarker());
1338 SALOMEDS::Color newColor;
1339 newColor.R = aDlg.getColor().red()/255.;
1340 newColor.G = aDlg.getColor().green()/255.;
1341 newColor.B = aDlg.getColor().blue()/255.;
1342 aDSCurve->SetColor( newColor );
1343 PlotCurve(this, aDSCurve, VISU::eDisplay);
1354 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1355 if (CheckLock(aCStudy))
1357 Handle(SALOME_InteractiveObject) anIO;
1358 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1359 if (anIO.IsNull() || CORBA::is_nil(anObject))
1362 VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
1363 if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TCONTAINER) {
1365 CORBA::Object_ptr aCnt = VISU::Container::_narrow(anObject);
1366 if (!CORBA::is_nil(aCnt)) {
1367 VISU::Container_i* container = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aCnt).in());
1368 if (container && container->GetNbCurves() > 0) {
1370 UpdateObjBrowser(this);
1380 Handle(SALOME_InteractiveObject) anIO;
1381 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1382 if (CORBA::is_nil(anObject)) return;
1384 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1385 if (!aServant.in()) return;
1386 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aServant.in());
1387 if (!aContainer) return;
1389 VisuGUI_EditContainerDlg* aDlg = new VisuGUI_EditContainerDlg (this);
1390 aDlg->initFromPrsObject(aContainer);
1392 aDlg->storeToPrsObject(aContainer);
1393 UpdateObjBrowser(this, true);
1402 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1403 if (CheckLock(aCStudy))
1406 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
1407 if (aViewMgr->getType() != SVTK_Viewer::Type())
1410 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1411 SALOME_ListIO aListIO;
1412 aSelectionMgr->selectedObjects(aListIO);
1413 if (aListIO.Extent() > 1)
1416 if (aListIO.Extent() == 0) {
1417 VISU::View3D_i::SaveViewParams(aViewMgr, VISU::View3D_i::GenerateViewParamsName().latin1());
1419 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1420 VISU::View3D_i::SaveViewParams(aViewMgr, anIO->getName());
1422 UpdateObjBrowser(this);
1427 OnRestoreViewParams()
1429 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
1430 if (aViewMgr->getType() != SVTK_Viewer::Type())
1433 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1434 SALOME_ListIO aListIO;
1435 aSelectionMgr->selectedObjects(aListIO);
1436 if (aListIO.Extent() != 1)
1439 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1440 //jfa tmp:VISU::View3D_i::RestoreViewParams(aViewMgr, anIO->getName());
1441 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));//jfa tmp
1442 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());//jfa tmp
1443 VISU::View3D_i::RestoreViewParams(aViewMgr, aSObj->GetName().c_str());//jfa tmp
1450 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1451 if (CheckLock(aCStudy))
1454 Handle(SALOME_InteractiveObject) anIO;
1455 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1457 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
1460 //TEST DU PARENT == VISU
1461 _PTR(StudyBuilder) aBuilder = aCStudy->NewBuilder();
1462 _PTR(GenericAttribute) anAttr = aBuilder->FindOrCreateAttribute(aSObj, "AttributeName");
1464 _PTR(AttributeName) aName (anAttr);
1465 QString Name = VisuGUI_NameDlg::getName( GetDesktop( this ), aName->Value().c_str() );
1466 if (!Name.isEmpty()) {
1467 QApplication::setOverrideCursor(Qt::waitCursor);
1469 // rename specific objects
1470 if (!CORBA::is_nil(anObject)) {
1471 VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
1472 if (!CORBA::is_nil(aVisuObj)) {
1473 switch (aVisuObj->GetType()) {
1474 case VISU::TCURVE: // Curve object
1476 CORBA::Object_ptr aCurve = VISU::Curve::_narrow(anObject);
1477 if (!CORBA::is_nil(aCurve)) {
1478 VISU::Curve_i* curve =
1479 dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
1481 curve->SetName(Name.latin1());
1485 case VISU::TTABLE: // Table object
1487 CORBA::Object_ptr aTable = VISU::Table::_narrow(anObject);
1488 if (!CORBA::is_nil(aTable)) {
1489 VISU::Table_i* table =
1490 dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTable).in());
1492 table->SetName(Name.latin1());
1496 case VISU::TCONTAINER: // Container object
1498 CORBA::Object_ptr aContainer = VISU::Container::_narrow(anObject);
1499 if (!CORBA::is_nil(aContainer)) {
1500 VISU::Container_i* container =
1501 dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
1503 container->SetName(Name.latin1());
1514 // rename the study object
1515 aName->SetValue(Name.latin1()); // rename the SObject
1516 anIO->setName(Name.latin1()); // rename the InteractiveObject
1517 UpdateObjBrowser(this, false);
1519 QApplication::restoreOverrideCursor();
1528 new VisuGUI_ClippingDlg (this, "", false);
1536 Handle(SALOME_InteractiveObject) anIO;
1537 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1538 if (CORBA::is_nil(anObject)) return;
1539 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1540 if (!aServant.in()) return;
1542 VISU::ScalarMap_i* aPrsObject = dynamic_cast<VISU::ScalarMap_i*>(aServant.in());
1543 if (!aPrsObject) return;
1545 SVTK_ViewWindow* vw = GetViewWindow();
1548 VISU_Actor* aActor = GetActor(aPrsObject, vw);
1549 if (!aActor) return;
1551 if (!aActor->GetVisibility()) {
1552 aActor->VisibilityOn();
1555 // Get sweep parameters
1556 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
1558 double aTempoDbl = aResourceMgr->doubleValue("VISU", "sweeping_time_step", 0.1);
1559 int aTemp = int(1.E6 * aTempoDbl);
1561 int aCycles = aResourceMgr->integerValue("VISU", "sweeping_number_cycles", 1);
1562 int aSteps = aResourceMgr->integerValue("VISU", "sweeping_time_step", 40);
1565 QApplication::setOverrideCursor(Qt::waitCursor);
1567 for (int j = 0; j < aCycles; j++) {
1568 for (int i = 0; i <= aSteps; i++) {
1569 float aPercents = float(i)/aSteps;
1570 aPrsObject->SetMapScale(aPercents);
1571 aPrsObject->UpdateActor(aActor);
1572 vw->getRenderWindow()->getRenderWindow()->Render();
1576 } catch (std::exception& exc) {
1577 INFOS("Follow exception was occured :\n" << exc.what());
1579 INFOS("Unknown exception was occured!");
1581 QApplication::restoreOverrideCursor();
1588 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1589 VisuGUI_TimeAnimationDlg* aAnimationDlg =
1590 // new VisuGUI_TimeAnimationDlg(GetDesktop(this), aCStudy);
1591 new VisuGUI_TimeAnimationDlg (this, aCStudy);
1593 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1594 SALOME_ListIO aListIO;
1595 aSelectionMgr->selectedObjects(aListIO);
1597 bool isDefined = false;
1599 SALOME_ListIteratorOfListIO It (aListIO);
1600 for (; It.More(); It.Next()) {
1601 _PTR(SObject) aSObject = aCStudy->FindObjectID(It.Value()->getEntry());
1602 if (!aSObject) continue;
1603 if (getValue(aSObject, "myComment") == QString("FIELD")) {
1604 long aNumber = getValue(aSObject, "myNbTimeStamps").toLong();
1608 aAnimationDlg->addField(aSObject);
1610 } else if (aNbTimes == aNumber) {
1611 aAnimationDlg->addField(aSObject);
1616 if (isDefined) aAnimationDlg->show();
1617 else delete aAnimationDlg;
1620 //************************************************************************
1625 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1626 SALOME_ListIO aListIO;
1627 aSelectionMgr->selectedObjects(aListIO);
1629 if (aListIO.Extent() != 1)
1632 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1634 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1636 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
1639 VISU::Storable::TRestoringMap aMap;
1640 _PTR(GenericAttribute) anAttr;
1641 if (!aSObj->FindAttribute(anAttr, "AttributeComment")) return;
1643 _PTR(AttributeComment) aComment (anAttr);
1644 string aComm = aComment->Value();
1645 QString strIn (aComm.c_str());
1646 VISU::Storable::StrToMap(strIn, aMap);
1648 VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
1649 if (aType != VISU::TANIMATION) return;
1651 VisuGUI_TimeAnimationDlg* aAnimationDlg =
1652 new VisuGUI_TimeAnimationDlg(this, aCStudy);
1653 aAnimationDlg->restoreFromStudy(aSObj);
1654 aAnimationDlg->show();
1659 OnCopyPresentation()
1661 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1662 if (CheckLock(aCStudy))
1665 Handle(SALOME_InteractiveObject) anIO;
1666 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1667 if (CORBA::is_nil(anObject)) return;
1668 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1669 if (!aServant.in()) return;
1671 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
1672 if (!aPrsObject) return;
1674 switch (aPrsObject->GetType()) {
1677 VISU::Mesh_i* aMeshPrs = dynamic_cast<VISU::Mesh_i*>(aPrsObject);
1678 VISU::Mesh_i* aSameMesh = new VISU::Mesh_i(aMeshPrs->GetResult());
1679 aSameMesh->SameAs(aMeshPrs);
1680 UpdateViewer(this, aSameMesh);
1683 case VISU::TSCALARMAP:
1685 VISU::ScalarMap_i* aScalarPrs = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
1686 VISU::ScalarMap_i* aSameScalar = new VISU::ScalarMap_i(aScalarPrs->GetResult(),true);
1687 aSameScalar->SameAs(aScalarPrs);
1688 UpdateViewer(this, aSameScalar);
1691 case VISU::TDEFORMEDSHAPE:
1693 VISU::DeformedShape_i* aDefPrs = dynamic_cast<VISU::DeformedShape_i*>(aPrsObject);
1694 VISU::DeformedShape_i* aSameDeformed = new VISU::DeformedShape_i(aDefPrs->GetResult(),true);
1695 aSameDeformed->SameAs(aDefPrs);
1696 UpdateViewer(this, aSameDeformed);
1699 case VISU::TCUTPLANES:
1701 VISU::CutPlanes_i* aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
1702 VISU::CutPlanes_i* aSameCut = new VISU::CutPlanes_i(aCutPrs->GetResult(),true);
1703 aSameCut->SameAs(aCutPrs);
1704 UpdateViewer(this, aSameCut);
1707 case VISU::TCUTLINES:
1709 VISU::CutLines_i* aCutPrs = dynamic_cast<VISU::CutLines_i*>(aPrsObject);
1710 VISU::CutLines_i* aSameCut = new VISU::CutLines_i(aCutPrs->GetResult(),true);
1711 aSameCut->SameAs(aCutPrs);
1712 UpdateViewer(this, aSameCut);
1715 case VISU::TISOSURFACE:
1717 VISU::IsoSurfaces_i* aIsoPrs = dynamic_cast<VISU::IsoSurfaces_i*>(aPrsObject);
1718 VISU::IsoSurfaces_i* aSameIso = new VISU::IsoSurfaces_i(aIsoPrs->GetResult(),true);
1719 aSameIso->SameAs(aIsoPrs);
1720 UpdateViewer(this, aSameIso);
1723 case VISU::TSTREAMLINES:
1725 VISU::StreamLines_i* aLinesPrs = dynamic_cast<VISU::StreamLines_i*>(aPrsObject);
1726 VISU::StreamLines_i* aSameLines = new VISU::StreamLines_i(aLinesPrs->GetResult(),true);
1727 aSameLines->SameAs(aLinesPrs);
1728 UpdateViewer(this, aSameLines);
1731 case VISU::TVECTORS:
1733 VISU::Vectors_i* aVectorsPrs = dynamic_cast<VISU::Vectors_i*>(aPrsObject);
1734 VISU::Vectors_i* aSameVectors = new VISU::Vectors_i(aVectorsPrs->GetResult(),true);
1735 aSameVectors->SameAs(aVectorsPrs);
1736 UpdateViewer(this, aSameVectors);
1741 VISU::Plot3D_i* aPlot3DPrs = dynamic_cast<VISU::Plot3D_i*>(aPrsObject);
1742 VISU::Plot3D_i* aSamePlot3D = new VISU::Plot3D_i(aPlot3DPrs->GetResult());
1743 aSamePlot3D->SameAs(aPlot3DPrs);
1744 UpdateViewer(this, aSamePlot3D);
1748 UpdateObjBrowser(this);
1755 if (GetViewWindow())
1756 (new VisuGUI_SelectionDlg(GetDesktop(this)))->show();
1758 SUIT_MessageBox::warn1(GetDesktop(this),
1760 tr("ERR_ACTIVATE_VIEW3D"),
1768 VisuGUI_NonIsometricDlg* m_NonIsoDlg =
1769 new VisuGUI_NonIsometricDlg (GetDesktop(this), "m_NonIsoDlg",
1770 false, Qt::WDestructiveClose);
1771 m_NonIsoDlg->show();
1778 //Show dialog that allows to select scale function and corresponding scale factor
1779 VisuGUI_CubeAxesDlg* aDlg = new VisuGUI_CubeAxesDlg (GetDesktop(this));
1787 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1788 SALOME_ListIO aListIO;
1789 aSelectionMgr->selectedObjects(aListIO);
1791 SALOME_ListIteratorOfListIO It (aListIO);
1793 // first find the bounds
1794 double aMin, aMax; bool first = true;
1795 for (; It.More(); It.Next()) {
1796 Handle(SALOME_InteractiveObject)& anIO = It.Value();
1797 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
1798 if (!aPrsList.empty()) {
1799 for (int i = 0, n = aPrsList.size(); i < n; i++) {
1800 VISU::Prs3d_i* aPrsObject = aPrsList[i];
1802 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
1806 aMin = aScalar->GetMin(); aMax = aScalar->GetMax();
1808 if (aScalar->GetMin() < aMin) aMin = aScalar->GetMin();
1809 if (aScalar->GetMax() > aMax) aMax = aScalar->GetMax();
1817 // set the computed range to every selected ScalarMap
1818 bool update = false;
1819 for (It.Initialize(aListIO); It.More(); It.Next() ) {
1820 Handle(SALOME_InteractiveObject)& anIO = It.Value();
1821 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
1822 if (!aPrsList.empty()) {
1823 for (int i = 0, n = aPrsList.size(); i < n; i++) {
1824 VISU::Prs3d_i* aPrsObject = aPrsList[i];
1826 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
1828 aScalar->SetRange(aMin, aMax);
1829 RecreateActor(this, aScalar);
1837 if (SVTK_ViewWindow* vw = GetViewWindow(this)) {
1838 //if (vw->getRenderer()->GetActors()->GetNumberOfItems() > 0) {
1839 vw->getRenderer()->ResetCameraClippingRange();
1850 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1851 SALOME_ListIO aListIO;
1852 aSelectionMgr->selectedObjects(aListIO);
1854 SALOME_ListIteratorOfListIO It (aListIO);
1856 // restore the source range for every ScalarMap
1857 bool update = false;
1858 for (; It.More(); It.Next()) {
1859 Handle(SALOME_InteractiveObject)& anIO = It.Value();
1860 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
1861 if (!aPrsList.empty()) {
1862 for (int i = 0, n = aPrsList.size(); i < n; i++) {
1863 VISU::Prs3d_i* aPrsObject = aPrsList[i];
1865 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
1867 aScalar->SetSourceRange();
1868 RecreateActor(this, aScalar);
1876 if (SVTK_ViewWindow* vw = GetViewWindow(this)) {
1877 //if (vw->getRenderer()->GetActors()->GetNumberOfItems() > 0) {
1878 vw->getRenderer()->ResetCameraClippingRange();
1889 if(MYDEBUG) MESSAGE("VisuGUI::OnTranslatePrs");
1890 VisuGUI_OffsetDlg* aDlg = new VisuGUI_OffsetDlg (this);
1892 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1894 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1895 SALOME_ListIO aListIO;
1896 aSelectionMgr->selectedObjects(aListIO);
1898 SALOME_ListIteratorOfListIO It (aListIO);
1899 for (; It.More(); It.Next()) {
1900 Handle(SALOME_InteractiveObject)& anIO = It.Value();
1901 if (anIO->hasEntry()) {
1902 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
1904 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSObject);
1905 if (!CORBA::is_nil(aCORBAObject)) {
1906 PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
1907 if (VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in())) {
1908 aDlg->addPresentation(aPrsObject);
1914 if (aDlg->getPrsCount() > 0)
1924 SVTK_ViewWindow* vw = GetViewWindow();
1926 ArrangeDlg* aDlg = new ArrangeDlg (GetDesktop(this), vw);
1935 initialize( CAM_Application* theApp )
1937 SalomeApp_Module::initialize( theApp );
1950 QWidget* aParent = application()->desktop();
1951 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
1954 createAction( VISU_IMPORT_FROM_FILE, "", QIconSet(),
1955 tr("MEN_IMPORT_FROM_FILE"), "", (CTRL + Key_I), aParent, false,
1956 this, SLOT(OnImportFromFile()));
1958 createAction( VISU_EXPLORE_MED, "", QIconSet(),
1959 tr("MEN_EXPLORE_MED_FILE"), "", (CTRL + Key_M), aParent, false,
1960 this, SLOT(OnExploreMEDFile()));
1962 createAction( VISU_IMPORT_TABLE, "", QIconSet(),
1963 tr("MEN_IMPORT_TABLE"), "", 0, aParent, false,
1964 this, SLOT(OnImportTableFromFile()));
1966 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP"));
1967 createAction( VISU_SCALAR_MAP, tr("MEN_SCALAR_MAP"), QIconSet(aPixmap),
1968 tr("MEN_SCALAR_MAP"), "", 0, aParent, false,
1969 this, SLOT(OnCreateScalarMap()));
1971 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_DEFORMED_SHAPE"));
1972 createAction( VISU_DEFORMED_SHAPE, tr("MEN_DEFORMED_SHAPE"), QIconSet(aPixmap),
1973 tr("MEN_DEFORMED_SHAPE"), "", 0, aParent, false,
1974 this, SLOT(OnCreateDeformedShape()));
1976 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_VECTORS"));
1977 createAction( VISU_VECTORS, tr("MEN_VECTORS"), QIconSet(aPixmap),
1978 tr("MEN_VECTORS"), "", 0, aParent, false,
1979 this, SLOT(OnCreateVectors()));
1981 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ISO_SURFACES"));
1982 createAction( VISU_ISO_SURFACES, tr("MEN_ISO_SURFACES"), QIconSet(aPixmap),
1983 tr("MEN_ISO_SURFACES"), "", 0, aParent, false,
1984 this, SLOT(OnCreateIsoSurfaces()));
1986 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_PLANES"));
1987 createAction( VISU_CUT_PLANES, tr("MEN_CUT_PLANES"), QIconSet(aPixmap),
1988 tr("MEN_CUT_PLANES"), "", 0, aParent, false,
1989 this, SLOT(OnCreateCutPlanes()));
1991 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_STREAM_LINES"));
1992 createAction( VISU_STREAM_LINES, tr("MEN_STREAM_LINES"), QIconSet(aPixmap),
1993 tr("MEN_STREAM_LINES"), "", 0, aParent, false,
1994 this, SLOT(OnCreateStreamLines()));
1996 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_LINES"));
1997 createAction( VISU_CUT_LINES, tr("MEN_CUT_LINES"), QIconSet(aPixmap),
1998 tr("MEN_CUT_LINES"), "", 0, aParent, false,
1999 this, SLOT(OnCreateCutLines()));
2001 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT_3D"));
2002 createAction( VISU_PLOT_3D, tr("MEN_PLOT_3D"), QIconSet(aPixmap),
2003 tr("MEN_PLOT_3D"), "", 0, aParent, false,
2004 this, SLOT(OnCreatePlot3D()));
2006 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT2D"));
2007 createAction( VISU_PLOT2D, tr("MEN_CREATE_PLOT2D"), QIconSet(aPixmap),
2008 tr("MEN_CREATE_PLOT2D"), "", 0, aParent, false,
2009 this, SLOT(OnCreatePlot2dView()));
2011 createAction( VISU_DELETE_OBJS, tr("MEN_DELETE_OBJS"), QIconSet(),
2012 tr("MEN_DELETE_OBJS"), "", 0, aParent, false,
2013 this, SLOT(OnDeleteObjects()));
2015 createAction( VISU_SHOW_TABLE, tr("MEN_SHOW_TABLE"), QIconSet(),
2016 tr("MEN_SHOW_TABLE"), "", 0, aParent, false,
2017 this, SLOT(OnShowTable()));
2019 createAction( VISU_CREATE_CURVES, tr("MEN_CREATE_CURVES"), QIconSet(),
2020 tr("MEN_CREATE_CURVES"), "", 0, aParent, false,
2021 this, SLOT(OnPlotData()));
2023 createAction( VISU_EXPORT_TABLE, tr("MEN_EXPORT_TABLE"), QIconSet(),
2024 tr("MEN_EXPORT_TABLE"), "", 0, aParent, false,
2025 this, SLOT(OnExportTableToFile()));
2027 createAction( VISU_IMPORT_MED_STRUCTURE, tr("MEN_IMPORT_MED_STRUCTURE"), QIconSet(),
2028 tr("MEN_IMPORT_MED_STRUCTURE"), "", 0, aParent, false,
2029 this, SLOT(OnImportMedField()));
2031 createAction( VISU_IMPORT_MED_TIMESTAMP, tr("MEN_IMPORT_MED_TIMESTAMP"), QIconSet(),
2032 tr("MEN_IMPORT_MED_TIMESTAMP"), "", 0, aParent, false,
2033 this, SLOT(OnImportMedField()));
2035 createAction( VISU_IMPORT_MED_FIELD, tr("MEN_IMPORT_MED_FIELD"), QIconSet(),
2036 tr("MEN_IMPORT_MED_FIELD"), "", 0, aParent, false,
2037 this, SLOT(OnImportMedField()));
2039 createAction( VISU_CREATE_PRS, tr("MEN_CREATE_PRS"), QIconSet(),
2040 tr("MEN_CREATE_PRS"), "", 0, aParent, false,
2041 this, SLOT(OnCreateMesh()));
2043 createAction( VISU_CREATE_MANY_PRS, tr("MEN_CREATE_MANY_PRS"), QIconSet(),
2044 tr("MEN_CREATE_MANY_PRS"), "", 0, aParent, false,
2045 this, SLOT(OnCreateManyMesh()));
2047 createAction( VISU_TRANSLATE_PRS, tr("MEN_TRANSLATE_PRS"), QIconSet(),
2048 tr("MEN_TRANSLATE_PRS"), "", 0, aParent, false,
2049 this, SLOT(OnTranslatePrs()));
2051 createAction( VISU_MERGE_SCALAR_BARS, tr("MEN_MERGE_SCALAR_BARS"), QIconSet(),
2052 tr("MEN_MERGE_SCALAR_BARS"), "", 0, aParent, false,
2053 this, SLOT(OnMergeScalarBars()));
2055 createAction( VISU_FREE_SCALAR_BARS, tr("MEN_FREE_SCALAR_BARS"), QIconSet(),
2056 tr("MEN_FREE_SCALAR_BARS"), "", 0, aParent, false,
2057 this, SLOT(OnFreeScalarBars()));
2059 createAction( VISU_ERASE, tr("MEN_ERASE"), QIconSet(),
2060 tr("MEN_ERASE"), "", 0, aParent, false,
2061 this, SLOT(OnErasePrs()));
2063 createAction( VISU_DISPLAY, tr("MEN_DISPLAY"), QIconSet(),
2064 tr("MEN_DISPLAY"), "", 0, aParent, false,
2065 this, SLOT(OnDisplayPrs()));
2067 createAction( VISU_DISPLAY_ONLY, tr("MEN_DISPLAY_ONLY"), QIconSet(),
2068 tr("MEN_DISPLAY_ONLY"), "", 0, aParent, false,
2069 this, SLOT(OnDisplayOnlyPrs()));
2071 createAction( VISU_COPY_PRS, tr("MEN_COPY_PRS"), QIconSet(),
2072 tr("MEN_COPY_PRS"), "", 0, aParent, false,
2073 this, SLOT(OnCopyPresentation()));
2075 createAction( VISU_CURVE_PROPS, tr("MEN_CURVE_PROPS"), QIconSet(),
2076 tr("MEN_CURVE_PROPS"), "", 0, aParent, false,
2077 this, SLOT(OnCurveProperties()));
2079 createAction( VISU_RENAME, tr("MEN_RENAME"), QIconSet(), tr("MEN_RENAME"), "", 0, aParent, false,
2080 this, SLOT(OnRename()));
2082 createAction( VISU_EDIT_CONTAINER, tr("MEN_EDIT_CONTAINER"), QIconSet(),
2083 tr("MEN_EDIT_CONTAINER"), "", 0, aParent, false,
2084 this, SLOT(OnEditContainer()));
2086 createAction( VISU_CLEAR_CONTAINER, tr("MEN_CLEAR_CONTAINER"), QIconSet(),
2087 tr("MEN_CLEAR_CONTAINER"), "", 0, aParent, false,
2088 this, SLOT(OnClearContainer()));
2090 createAction( VISU_SAVE_VIEW_PARAMS, tr("MEN_SAVE_VIEWPARAMS"), QIconSet(),
2091 tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
2092 this, SLOT(OnSaveViewParams()));
2093 createAction( VISU_SAVE_VIEW_PARAMS_1, tr("MEN_SAVE_VIEWPARAMS"), QIconSet(),
2094 tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
2095 this, SLOT(OnSaveViewParams()));
2097 createAction( VISU_RESTORE_VIEW_PARAMS, tr("MEN_RESTORE_VIEWPARAMS"), QIconSet(),
2098 tr("MEN_RESTORE_VIEWPARAMS"), "", 0, aParent, false,
2099 this, SLOT(OnRestoreViewParams()));
2101 //createAction( VISU_DELETE_VIEW_PARAMS, tr("MEN_DELETE_VIEWPARAMS"), QIconSet(),
2102 // tr("MEN_DELETE_VIEWPARAMS"), "", 0, aParent, false,
2103 // this, SLOT(OnDeleteObjects()));
2105 createAction( VISU_ARRANGE_ACTORS, tr("MEN_ARRANGE_ACTORS"), QIconSet(),
2106 tr("MEN_ARRANGE_ACTORS"), "", 0, aParent, false,
2107 this, SLOT(OnArrangeActors()));
2109 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_POINTS"));
2110 createAction( VISU_POINTS, tr("MEN_POINTS"), QIconSet(aPixmap),
2111 tr("MEN_POINTS"), "", 0, aParent, false,
2112 this, SLOT(OnMakePoints()));
2114 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_WIREFRAME"));
2115 createAction( VISU_WIREFRAME, tr("MEN_WIREFRAME"), QIconSet(aPixmap),
2116 tr("MEN_WIREFRAME"), "", 0, aParent, false,
2117 this, SLOT(OnMakeWireframe()));
2119 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SURFACE"));
2120 createAction( VISU_SURFACE, tr("MEN_SURFACE"), QIconSet(aPixmap),
2121 tr("MEN_SURFACE"), "", 0, aParent, false,
2122 this, SLOT(OnMakeSurface()));
2124 createAction( VISU_INSIDEFRAME, tr("MEN_INSIDEFRAME"), QIconSet(),
2125 tr("MEN_INSIDEFRAME"), "", 0, aParent, false,
2126 this, SLOT(OnMakeInsideframe()));
2128 createAction( VISU_SURFACEFRAME, tr("MEN_SURFACEFRAME"), QIconSet(),
2129 tr("MEN_SURFACEFRAME"), "", 0, aParent, false,
2130 this, SLOT(OnMakeSurfaceframe()));
2132 createAction( VISU_SHRINK, tr("MEN_SHRINK"), QIconSet(),
2133 tr("MEN_SHRINK"), "", 0, aParent, false,
2134 this, SLOT(OnMakeShrink()));
2136 createAction( VISU_UNSHRINK, tr("MEN_UNSHRINK"), QIconSet(),
2137 tr("MEN_UNSHRINK"), "", 0, aParent, false,
2138 this, SLOT(OnMakeShrink()));
2140 createAction( VISU_CELL_COLOR, tr("MEN_CELL_COLOR"), QIconSet(),
2141 tr("MEN_CELL_COLOR"), "", 0, aParent, false,
2142 this, SLOT(OnChangeColor()));
2144 createAction( VISU_COLOR, tr("MEN_COLOR"), QIconSet(),
2145 tr("MEN_COLOR"), "", 0, aParent, false,
2146 this, SLOT(OnChangeColor()));
2148 createAction( VISU_EDGE_COLOR, tr("MEN_EDGE_COLOR"), QIconSet(),
2149 tr("MEN_EDGE_COLOR"), "", 0, aParent, false,
2150 this, SLOT(OnChangeWireframeColor()));
2152 createAction( VISU_OPACITY, tr("MEN_OPACITY"), QIconSet(),
2153 tr("MEN_OPACITY"), "", 0, aParent, false,
2154 this, SLOT(OnChangeOpacity()));
2156 createAction( VISU_LINE_WIDTH, tr("MEN_LINE_WIDTH"), QIconSet(),
2157 tr("MEN_LINE_WIDTH"), "", 0, aParent, false,
2158 this, SLOT(OnChangeLines()));
2161 createAction( VISU_EDIT_SCALARMAP, tr("MEN_EDIT_PRS"), QIconSet(),
2162 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2163 this, SLOT(OnEditScalarMap()));
2165 createAction( VISU_EDIT_DEFORMEDSHAPE, tr("MEN_EDIT_PRS"), QIconSet(),
2166 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2167 this, SLOT(OnEditDeformedShape()));
2169 createAction( VISU_EDIT_CUTPLANES, tr("MEN_EDIT_PRS"), QIconSet(),
2170 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2171 this, SLOT(OnEditCutPlanes()));
2173 createAction( VISU_EDIT_CUTLINES, tr("MEN_EDIT_PRS"), QIconSet(),
2174 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2175 this, SLOT(OnEditCutLines()));
2177 createAction( VISU_EDIT_ISOSURFACE, tr("MEN_EDIT_PRS"), QIconSet(),
2178 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2179 this, SLOT(OnEditIsoSurfaces()));
2181 createAction( VISU_EDIT_VECTORS, tr("MEN_EDIT_PRS"), QIconSet(),
2182 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2183 this, SLOT(OnEditVectors()));
2185 createAction( VISU_EDIT_STREAMLINES, tr("MEN_EDIT_PRS"), QIconSet(),
2186 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2187 this, SLOT(OnEditStreamLines()));
2189 createAction( VISU_EDIT_PLOT3D, tr("MEN_EDIT_PRS"), QIconSet(),
2190 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2191 this, SLOT(OnEditPlot3D()));
2194 createAction( VISU_CREATE_TABLE, tr("MEN_CREATE_TABLE"), QIconSet(),
2195 tr("MEN_CREATE_TABLE"), "", 0, aParent, false,
2196 this, SLOT(OnCreateTable()));
2198 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SWEEP"));
2199 createAction( VISU_SWEEP, tr("MEN_SWEEP"), QIconSet(aPixmap),
2200 tr("MEN_SWEEP"), "", 0, aParent, false,
2201 this, SLOT(OnSweep()));
2203 createAction( VISU_CLIPPING, tr("MEN_CLIPPING"), QIconSet(),
2204 tr("MEN_CLIPPING"), "", 0, aParent, false,
2205 this, SLOT(OnClippingPlanes()));
2207 createAction( VISU_SELECTION_INFO, tr("MEN_SELECTION_INFO"), QIconSet(),
2208 tr("MEN_SELECTION_INFO"), "", 0, aParent, false,
2209 this, SLOT(OnSelectionInfo()));
2211 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_TIMEANIMATION"));
2212 createAction( VISU_ANIMATION, tr("MEN_ANIMATION"), QIconSet(aPixmap),
2213 tr("MEN_ANIMATION"), "", 0, aParent, false,
2214 this, SLOT(OnTimeAnimation()));
2216 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ERASE_ALL"));
2217 createAction( VISU_ERASE_ALL, tr("MEN_ERASE_ALL"), QIconSet(aPixmap),
2218 tr("MEN_ERASE_ALL"), "", 0, aParent, false,
2219 this, SLOT(OnEraseAll()));
2221 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_GLOBAL_SELECTION"));
2222 createAction( VISU_GLOBAL_SELECTION, tr("MEN_GLOBAL_SELECTION"), QIconSet(aPixmap),
2223 tr("MEN_GLOBAL_SELECTION"), "", 0, aParent, false,
2224 //this, SLOT(OnEraseAll()));
2227 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PARTIAL_SELECTION"));
2228 createAction( VISU_PARTIAL_SELECTION, tr("MEN_PARTIAL_SELECTION"), QIconSet(aPixmap),
2229 tr("MEN_PARTIAL_SELECTION"), "", 0, aParent, false,
2230 //this, SLOT(OnEraseAll()));
2233 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALING"));
2234 createAction( VISU_SCALING, tr("MEN_SCALING"), QIconSet(aPixmap),
2235 tr("MEN_SCALING"), "", 0, aParent, false,
2236 this, SLOT(OnScaling()));
2238 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUBE_AXES"));
2239 createAction( VISU_CUBE_AXES, tr("MEN_CUBE_AXES"), QIconSet(aPixmap),
2240 tr("MEN_CUBE_AXES"), "", 0, aParent, false,
2241 this, SLOT(OnCubeAxes()));
2243 createAction( VISU_SHOW_ANIMATION, tr("MEN_SHOW_ANIMATION"), QIconSet(),
2244 tr("MEN_SHOW_ANIMATION"), "", 0, aParent, false,
2245 this, SLOT(OnShowAnimation()));
2252 // Add actions to menus
2254 aMenuId = createMenu( tr( "MEN_DESK_FILE" ), -1 );
2255 createMenu( separator(), aMenuId, -1, 10 );
2256 createMenu( VISU_IMPORT_FROM_FILE, aMenuId, 10 ); // import from file
2257 createMenu( VISU_EXPLORE_MED, aMenuId, 10 ); // explore MED file
2258 createMenu( VISU_IMPORT_TABLE, aMenuId, 10 ); // import table
2260 aMenuId = createMenu( tr( "MEN_VISUALIZATION" ), -1, -1, 30 );
2261 createMenu( VISU_SCALAR_MAP, aMenuId, 10 ); // scalar map
2262 createMenu( VISU_DEFORMED_SHAPE, aMenuId, 10 ); // deformed shape
2263 createMenu( VISU_VECTORS, aMenuId, 10 ); // vectors
2264 createMenu( VISU_ISO_SURFACES, aMenuId, 10 ); // iso surfaces
2265 createMenu( VISU_CUT_PLANES, aMenuId, 10 ); // cut planes
2266 createMenu( VISU_CUT_LINES, aMenuId, 10 ); // cut lines
2267 createMenu( VISU_STREAM_LINES, aMenuId, 10 ); // stream lines
2268 createMenu( VISU_PLOT_3D, aMenuId, 10 ); // Plot3d
2270 aMenuId = createMenu( tr( "MEN_SELECTION" ), -1, -1, 30 );
2271 createMenu( VISU_SELECTION_INFO, aMenuId, 10 ); // selection info
2273 aMenuId = createMenu( tr( "MEN_REPRESENTATION" ), -1, -1, 30 );
2275 createMenu( tr( "MEN_DISPLAY_SELECTION" ), aMenuId, 10 ); // display selection
2276 createMenu( VISU_POINTS, parentId, 10 ); // points
2277 createMenu( VISU_WIREFRAME, parentId, 10 ); // wireframe
2278 createMenu( VISU_SURFACE, parentId, 10 ); // surface
2279 createMenu( VISU_ERASE_ALL, aMenuId, 10 ); // erase all
2280 createMenu( VISU_GLOBAL_SELECTION, aMenuId, 10 ); // global selection
2281 createMenu( VISU_PARTIAL_SELECTION, aMenuId, 10 ); // partial selection
2282 createMenu( VISU_SCALING, aMenuId, 10 ); // scaling
2283 createMenu( VISU_CUBE_AXES, aMenuId, 10 ); // scaling
2290 int aToolId = createTool(tr("TOOL_VISUALISATION"));
2291 createTool( VISU_SCALAR_MAP, aToolId );
2292 createTool( VISU_DEFORMED_SHAPE, aToolId );
2293 createTool( VISU_VECTORS, aToolId );
2294 createTool( VISU_ISO_SURFACES, aToolId );
2295 createTool( VISU_CUT_PLANES, aToolId );
2296 createTool( VISU_CUT_LINES, aToolId );
2297 createTool( VISU_STREAM_LINES, aToolId );
2298 createTool( VISU_PLOT_3D, aToolId );
2300 aToolId = createTool(tr("TOOL_REPRESENTATION"));
2301 createTool( VISU_POINTS, aToolId );
2302 createTool( VISU_WIREFRAME, aToolId );
2303 createTool( VISU_SURFACE, aToolId );
2304 createTool( VISU_ERASE_ALL, aToolId );
2305 createTool( VISU_GLOBAL_SELECTION, aToolId );
2306 createTool( VISU_PARTIAL_SELECTION, aToolId );
2307 createTool( VISU_SCALING, aToolId );
2308 createTool( VISU_CUBE_AXES, aToolId );
2315 // Prepare popup menus
2316 QtxPopupMgr* mgr = popupMgr();
2318 // VISU root commands
2319 mgr->insert( action( VISU_IMPORT_FROM_FILE ), -1, -1, -1 ); // import MED file
2320 mgr->insert( action( VISU_IMPORT_TABLE ), -1, -1, -1 ); // import tables from file
2321 mgr->insert( action( VISU_PLOT2D ), -1, -1, -1 ); // create Plot2d View
2323 //mgr->insert( action( VISU_IMPORT_MED ), -1, -1, -1 ); // import MED structure from MED module
2326 mgr->insert( action( VISU_SCALAR_MAP ), -1, -1, -1 ); // scalar bar
2327 mgr->insert( action( VISU_ISO_SURFACES ), -1, -1, -1 ); // iso surface
2328 mgr->insert( action( VISU_CUT_PLANES ), -1, -1, -1 ); // cut planes
2329 mgr->insert( action( VISU_CUT_LINES ), -1, -1, -1 ); // cut lines
2330 mgr->insert( action( VISU_DEFORMED_SHAPE ), -1, -1, -1 ); // deformed shape
2331 mgr->insert( action( VISU_VECTORS ), -1, -1, -1 ); // vectors
2332 mgr->insert( action( VISU_STREAM_LINES ), -1, -1, -1 ); // stream lines
2333 mgr->insert( action( VISU_PLOT_3D ), -1, -1, -1 ); // Plot3d
2335 mgr->insert( action( VISU_CREATE_PRS ), -1, -1, -1 ); // create presentation
2336 mgr->insert( action( VISU_CREATE_MANY_PRS ), -1, -1, -1 ); // create presentations
2338 mgr->insert( action( VISU_CREATE_TABLE ), -1, -1, -1 ); // create table
2341 mgr->insert( action( VISU_EDIT_SCALARMAP ), -1, -1, -1 );
2342 mgr->insert( action( VISU_EDIT_DEFORMEDSHAPE ), -1, -1, -1 );
2343 mgr->insert( action( VISU_EDIT_CUTPLANES ), -1, -1, -1 );
2344 mgr->insert( action( VISU_EDIT_CUTLINES ), -1, -1, -1 );
2345 mgr->insert( action( VISU_EDIT_ISOSURFACE ), -1, -1, -1 );
2346 mgr->insert( action( VISU_EDIT_VECTORS ), -1, -1, -1 );
2347 mgr->insert( action( VISU_EDIT_STREAMLINES ), -1, -1, -1 );
2348 mgr->insert( action( VISU_EDIT_PLOT3D ), -1, -1, -1 );
2349 mgr->insert( action( VISU_EDIT_CONTAINER ), -1, -1, -1 );
2352 mgr->insert( action( VISU_RENAME ), -1, -1, -1 );
2355 mgr->insert( action( VISU_COPY_PRS ), -1, -1, -1 );
2358 mgr->insert( action( VISU_CLEAR_CONTAINER ), -1, -1, -1 );
2361 //mgr->insert( action( VISU_SHOW_TABLE ), -1, -1, -1 ); // show table
2362 //mgr->insert( action( VISU_CREATE_CURVES ), -1, -1, -1 ); // create curves
2363 //mgr->insert( action( VISU_EXPORT_TABLE ), -1, -1, -1 ); // export table
2365 mgr->insert( separator(), -1, -1, -1 );
2367 mgr->insert( action( VISU_ERASE ), -1, -1, -1 ); // erase
2368 mgr->insert( action( VISU_DISPLAY ), -1, -1, -1 ); // display
2369 mgr->insert( action( VISU_DISPLAY_ONLY ), -1, -1, -1 ); // display only
2371 // "Representation" submenu
2372 int parentId = mgr->insert( tr( "MEN_REPRESENTATION" ), -1, -1 );
2373 mgr->insert( action( VISU_POINTS ) , parentId, -1, -1 ); // points
2374 mgr->insert( action( VISU_WIREFRAME ) , parentId, -1, -1 ); // wireframe
2375 mgr->insert( action( VISU_SURFACE ) , parentId, -1, -1 ); // surface
2376 mgr->insert( action( VISU_INSIDEFRAME ) , parentId, -1, -1 ); // insideframe
2377 mgr->insert( action( VISU_SURFACEFRAME ), parentId, -1, -1 ); // surfaceframe
2378 mgr->insert( action( VISU_SHRINK ) , parentId, -1, -1 ); // shrink
2379 mgr->insert( action( VISU_UNSHRINK ) , parentId, -1, -1 ); // unshrink
2381 // "Properties" submenu
2382 parentId = mgr->insert( tr( "MEN_PROPERTIES" ), -1, -1 );
2383 mgr->insert( action( VISU_CELL_COLOR ), parentId, -1, -1 ); // cell color
2384 mgr->insert( action( VISU_EDGE_COLOR ), parentId, -1, -1 ); // edge color
2385 mgr->insert( action( VISU_COLOR ) , parentId, -1, -1 ); // color
2386 mgr->insert( action( VISU_OPACITY ) , parentId, -1, -1 ); // opacity
2387 mgr->insert( action( VISU_LINE_WIDTH ), parentId, -1, -1 ); // line width
2389 mgr->insert( separator(), -1, -1, -1 );
2391 // Other presentations management
2392 mgr->insert( action( VISU_TRANSLATE_PRS ), -1, -1, -1 );
2393 mgr->insert( action( VISU_CLIPPING ), -1, -1, -1 );
2395 mgr->insert( action( VISU_MERGE_SCALAR_BARS ), -1, -1, -1 );
2396 mgr->insert( action( VISU_FREE_SCALAR_BARS ), -1, -1, -1 );
2398 mgr->insert( action( VISU_SWEEP ), -1, -1, -1 );
2399 mgr->insert( action( VISU_ANIMATION ), -1, -1, -1 );
2401 mgr->insert( separator(), -1, -1, -1 );
2403 // view parameters commands
2404 mgr->insert( action( VISU_SAVE_VIEW_PARAMS ), -1, -1, -1 ); // save view params
2405 mgr->insert( action( VISU_SAVE_VIEW_PARAMS_1 ), -1, -1, -1 ); // save view params
2406 mgr->insert( action( VISU_RESTORE_VIEW_PARAMS ), -1, -1, -1 ); // restore view params
2407 //mgr->insert( action( VISU_DELETE_VIEW_PARAMS ), -1, -1, -1 ); // delete view params
2409 mgr->insert( action( VISU_ARRANGE_ACTORS ), -1, -1, -1 ); // arrange actors
2411 mgr->insert( action( VISU_CURVE_PROPS ), -1, -1, -1 ); // curve properties
2413 mgr->insert( action( VISU_SELECTION_INFO ), -1, -1, -1 ); // Selection info
2417 QString aPrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
2418 "'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D'");
2420 // VISU root commands
2421 QString aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TVISUGEN'";
2422 mgr->setRule( action( VISU_IMPORT_FROM_FILE ), aRule, true );
2423 mgr->setRule( action( VISU_IMPORT_TABLE ), aRule, true );
2424 mgr->setRule( action( VISU_PLOT2D ), aRule, true );
2426 // timestamp commands
2427 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TTIMESTAMP'";
2428 mgr->setRule( action( VISU_SCALAR_MAP ), aRule, true );
2429 mgr->setRule( action( VISU_ISO_SURFACES ), aRule, true );
2430 mgr->setRule( action( VISU_CUT_PLANES ), aRule, true );
2431 mgr->setRule( action( VISU_CUT_LINES ), aRule, true );
2432 mgr->setRule( action( VISU_PLOT_3D ), aRule, true );
2433 aRule += " and nbComponents>1";
2434 mgr->setRule( action( VISU_DEFORMED_SHAPE ), aRule, true );
2435 mgr->setRule( action( VISU_VECTORS ), aRule, true );
2436 mgr->setRule( action( VISU_STREAM_LINES ), aRule, true );
2438 // display/erase commands
2439 QString andInvisible = " and (((not isVisible) and isActiveView) or (not isActiveView))";
2440 QString aTableOrCont = "(type='VISU::TTABLE' and nbChildren>0) or type='VISU::TCONTAINER'";
2441 QString orCurveVisible = "or (type='VISU::TCURVE' and isVisible)";
2442 QString orCurveInvisible = "or (type='VISU::TCURVE'" + andInvisible + ")";
2443 QString aPrsVisible = "(($type in {'VISU::TMESH' " + aPrsAll + "}) and isVisible)";
2444 QString aPrsInvisible = "(($type in {'VISU::TMESH' " + aPrsAll + "})" + andInvisible + ")";
2446 QString anEraseRule = "selcount>0 and (" + aPrsVisible +
2447 " or (client='ObjectBrowser' and (" + aTableOrCont + orCurveVisible + ")))";
2449 QString aDisplayRule = "selcount>0 and (" + aPrsInvisible +
2450 " or (client='ObjectBrowser' and (" + aTableOrCont + orCurveInvisible + ")))";
2452 QString aDOnlyRule = "selcount>0 and (($type in {'VISU::TMESH' " + aPrsAll + "})"
2453 " or (client='ObjectBrowser' and ((type='VISU::TTABLE' and nbChildren>0) or"
2454 " ($type in {'VISU::TCURVE' 'VISU::TCONTAINER'}))))";
2456 mgr->setRule( action( VISU_ERASE ), anEraseRule, true );
2457 mgr->setRule( action( VISU_DISPLAY ), aDisplayRule, true );
2458 mgr->setRule( action( VISU_DISPLAY_ONLY ), aDOnlyRule, true );
2460 aRule = "selcount>0 and $type in {'VISU::TMESH' " + aPrsAll + "}";
2461 mgr->setRule( action( VISU_TRANSLATE_PRS ), aRule, true );
2463 aRule = "selcount>1 and $type in {'VISU::TMESH' " + aPrsAll + "}";
2464 mgr->setRule( action( VISU_MERGE_SCALAR_BARS ), aRule, true );
2465 mgr->setRule( action( VISU_FREE_SCALAR_BARS ), aRule, true );
2468 aRule = "selcount=1 and type='VISU::TVIEW3D'";
2469 mgr->setRule( action( VISU_SAVE_VIEW_PARAMS_1 ), aRule, true );
2470 mgr->setRule( action( VISU_SAVE_VIEW_PARAMS ), "client='VTKViewer' and selcount=0", true );
2471 mgr->setRule( action( VISU_RESTORE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D'", true );
2472 //mgr->setRule( action( VISU_DELETE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D'", true );
2474 mgr->setRule( action( VISU_ARRANGE_ACTORS ), "client='VTKViewer' and selcount=0", true );
2476 // 3D presentations commands
2477 QString aPrsType = " and $type in {'VISU::TMESH' " + aPrsAll + "}";
2478 QString aInsideType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE'}";
2479 QString aSurfType = " and $type in {'VISU::TMESH'}";
2480 QString aShrinkType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' "
2481 "'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TPLOT3D'}";
2482 QString aLineType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
2483 "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D'}";
2485 aRule = "selcount=1";
2486 mgr->setRule( action( VISU_CLIPPING ), aRule + aPrsType, true );
2488 // "Representation" submenu
2489 QString aNotPoints = " and $representation in {'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}";
2490 QString aNotWirefr = " and $representation in {'VISU::POINT' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}";
2491 QString aNotSurfac = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}";
2492 QString aNotInside = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::SURFACEFRAME'}";
2493 QString aNotSurffr = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}";
2495 mgr->setRule( action( VISU_POINTS ) , aRule + aPrsType + aNotPoints, true );
2496 mgr->setRule( action( VISU_WIREFRAME ) , aRule + aPrsType + aNotWirefr, true );
2497 mgr->setRule( action( VISU_SURFACE ) , aRule + aPrsType + aNotSurfac, true );
2498 mgr->setRule( action( VISU_INSIDEFRAME ) , aRule + aInsideType + aNotInside, true );
2499 mgr->setRule( action( VISU_SURFACEFRAME ), aRule + aSurfType + aNotSurffr, true );
2501 mgr->setRule( action( VISU_SHRINK ) , aRule + aShrinkType + " and isShrunk=0", true );
2502 mgr->setRule( action( VISU_UNSHRINK ), aRule + aShrinkType + " and isShrunk=1", true );
2504 // "Properties" submenu
2505 mgr->setRule( action( VISU_CELL_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'", true );
2506 mgr->setRule( action( VISU_EDGE_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'", true );
2507 mgr->setRule( action( VISU_COLOR ), aRule + " and ((type='VISU::TMESH'"
2508 " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}) "
2509 "or (type='VISU::TDEFORMEDSHAPE' and hasActor=1))", true );
2510 mgr->setRule( action( VISU_OPACITY ), aRule + aShrinkType + " and hasActor=1", true );
2511 mgr->setRule( action( VISU_LINE_WIDTH ), aRule + aLineType + " and hasActor=1", true );
2514 QString aCurveAll = "'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER'";
2516 aRule = "selcount=1 and ($type in {'VISU::TVIEW3D' 'VISU::TMESH' " + aCurveAll + " " + aPrsAll + "})";
2517 mgr->setRule( action( VISU_RENAME ), aRule, true );
2519 // copy presentation command
2520 aRule = "selcount=1 and ($type in {" + aPrsAll + "})";
2521 mgr->setRule( action( VISU_COPY_PRS ), aRule, true );
2524 aRule = "selcount=1 and type='VISU::TCURVE'";
2525 mgr->setRule( action( VISU_CURVE_PROPS ), aRule, true );
2527 // curve container commands
2528 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TCONTAINER'";
2529 mgr->setRule( action( VISU_EDIT_CONTAINER ), aRule, true );
2530 mgr->setRule( action( VISU_CLEAR_CONTAINER ), aRule, true );
2532 mgr->setRule( action( VISU_EDIT_SCALARMAP ),
2533 "selcount=1 and type='VISU::TSCALARMAP'", true );
2534 mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPE ),
2535 "selcount=1 and type='VISU::TDEFORMEDSHAPE'", true );
2536 mgr->setRule( action( VISU_EDIT_CUTPLANES ),
2537 "selcount=1 and type='VISU::TCUTPLANES'", true );
2538 mgr->setRule( action( VISU_EDIT_CUTLINES ),
2539 "selcount=1 and type='VISU::TCUTLINES'", true );
2540 mgr->setRule( action( VISU_EDIT_ISOSURFACE ),
2541 "selcount=1 and type='VISU::TISOSURFACE'", true );
2542 mgr->setRule( action( VISU_EDIT_VECTORS ),
2543 "selcount=1 and type='VISU::TVECTORS'", true );
2544 mgr->setRule( action( VISU_EDIT_STREAMLINES ),
2545 "selcount=1 and type='VISU::TSTREAMLINES'", true );
2546 mgr->setRule( action( VISU_EDIT_PLOT3D ),
2547 "selcount=1 and type='VISU::TPLOT3D'", true );
2549 aRule = "selcount=1 and type='VISU::TCUTLINES' and nbNamedChildren=0";
2550 mgr->setRule( action( VISU_CREATE_TABLE ), aRule, true );
2552 aRule = "selcount=1 and ($type in {" + aPrsAll + "})";
2553 mgr->setRule( action( VISU_SWEEP ), aRule, true );
2555 // "Selection info" popup item
2556 aRule = "client='VTKViewer' and selcount=1" + aInsideType;
2557 mgr->setRule( action( VISU_SELECTION_INFO ), aRule, true );
2559 aRule = "client='ObjectBrowser' and selcount>0 and $type in {'VISU::TFIELD'} and nbTimeStamps>1";
2560 mgr->setRule( action( VISU_ANIMATION ), aRule, true );
2562 aRule = "client='ObjectBrowser' and $type in {'VISU::TENTITY' 'VISU::TFAMILY' 'VISU::TGROUP'}";
2563 mgr->setRule( action( VISU_CREATE_PRS ), aRule + " and selcount=1", true );
2564 mgr->setRule( action( VISU_CREATE_MANY_PRS ), aRule + " and selcount>1", true );
2566 //aRule = "client='ObjectBrowser' and type='MEDFIELD'";
2567 //mgr->setRule( action( VISU_IMPORT_MED ), aRule, true );
2570 //***************************************************************************
2571 void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, QString& theTitle )
2573 SalomeApp_Module::contextMenuPopup(theClient, theMenu, theTitle);
2575 OB_Browser* ob = getApp()->objectBrowser();
2576 bool isOBClient = (ob && theClient == ob->popupClientType());
2578 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2579 SALOME_ListIO aListIO;
2580 aSelectionMgr->selectedObjects(aListIO);
2582 if (aListIO.Extent() < 1) return;
2584 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2586 // Check if "Merge Scalar Range" can be applied
2588 SALOME_ListIteratorOfListIO It (aListIO);
2589 for (; It.More(); It.Next()) {
2590 Handle(SALOME_InteractiveObject)& anIO = It.Value();
2592 if (!anIO.IsNull() && anIO->hasEntry()) {
2593 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
2594 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSObject);
2595 if (CORBA::is_nil(aCORBAObject)) {
2596 _PTR(GenericAttribute) anAttr;
2597 if (aSObject->FindAttribute(anAttr, "AttributeComment")) {
2598 _PTR(AttributeComment) aComment (anAttr);
2599 string aComm = aComment->Value();
2600 QString strIn (aComm.c_str());
2601 VISU::Storable::TRestoringMap pMap;
2602 VISU::Storable::StrToMap(strIn, pMap);
2604 VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(pMap,"myType",&isExist).toInt();
2605 if (isExist && aType == VISU::TTIMESTAMP) {
2606 _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(aSObject);
2608 for (; anIter->More(); anIter->Next()) {
2609 aPrs = anIter->Value();
2610 if (!aPrs) continue;
2611 std::vector<VISU::Prs3d_i*> aSubList = GetPrs3dList(this, aPrs);
2612 nbPrs += aSubList.size();
2621 theMenu->insertSeparator();
2622 action( VISU_MERGE_SCALAR_BARS )->addTo(theMenu);
2623 action( VISU_FREE_SCALAR_BARS )->addTo(theMenu);
2626 theMenu->insertSeparator();
2628 // Check if some (nb > 0) removable objects selected
2629 if (isOBClient && IsRemovableSelected(this)) {
2630 action( VISU_DELETE_OBJS )->addTo(theMenu);
2633 // Check single selection
2634 if (aListIO.Extent() != 1) return;
2636 Handle(SALOME_InteractiveObject) anIO;
2637 VISU::Storable::TRestoringMap aMap;
2638 CORBA::Object_var anObject = GetSelectedObj( this, &anIO, &aMap);
2640 _PTR(SObject) SO = aCStudy->FindObjectID(anIO->getEntry());
2642 VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
2644 if (aType == VISU::TANIMATION) {
2645 action( VISU_SHOW_ANIMATION )->addTo(theMenu);
2647 } else if (isOBClient) {
2648 if (IsSObjectTable(SO)) {
2649 action( VISU_SHOW_TABLE )->addTo(theMenu);
2650 action( VISU_CREATE_CURVES )->addTo(theMenu);
2651 action( VISU_EXPORT_TABLE )->addTo(theMenu);
2652 theMenu->insertSeparator();
2654 if (!CORBA::is_nil(anObject)) {
2655 SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
2656 if (!CORBA::is_nil(aMED.in())) {
2657 action( VISU_IMPORT_MED_STRUCTURE )->addTo(theMenu);
2660 SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject); // "Import Structure"
2661 if (!CORBA::is_nil(aField)) {
2662 action( VISU_IMPORT_MED_TIMESTAMP )->addTo(theMenu); // "Import TimeStamp"
2665 _PTR(SObject) aSFather = SO->GetFather();
2667 _PTR(GenericAttribute) anAttr;
2668 aSFather->FindAttribute(anAttr, "AttributeName");
2670 _PTR(AttributeName) aName (anAttr);
2671 std::string aValue = aName->Value();
2672 if (strcmp(aValue.c_str(), "MEDFIELD") == 0) {
2673 action( VISU_IMPORT_MED_FIELD )->addTo(theMenu); // "Import Field"
2683 //***************************************************************************
2686 windows( QMap<int, int>& theMap ) const
2689 theMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::DockLeft );
2690 theMap.insert( SalomeApp_Application::WT_PyConsole, Qt::DockBottom );
2696 viewManagers( QStringList& theList ) const
2699 theList.append( SVTK_Viewer::Type() );
2707 CORBA::String_var anIOR = GetVisuGen(this)->GetID();
2708 return QString(anIOR.in());
2714 activateModule( SUIT_Study* theStudy )
2716 SalomeApp_Module::activateModule( theStudy );
2718 setMenuShown( true );
2719 setToolShown( true );
2726 deactivateModule( SUIT_Study* theStudy )
2728 setMenuShown( false );
2729 setToolShown( false );
2731 SalomeApp_Module::deactivateModule( theStudy );
2735 SalomeApp_Selection*
2737 createSelection() const
2739 return new VisuGUI_Selection( (SalomeApp_Module*)this );
2742 //******************************************************************
2743 void VisuGUI::studyActivated()
2745 GetVisuGen(this)->SetCurrentStudy(GetDSStudy(GetCStudy(GetAppStudy(this))));
2753 return new VisuGUI();
2757 void VisuGUI::createPreferences()
2759 int sbarTab = addPreference( tr( "VISU_SCALAR_BAR" ) );
2761 int fontGr = addPreference( tr( "VISU_FONT" ), sbarTab );
2762 int tfont = addPreference( tr( "VISU_TITLE" ), fontGr, SalomeApp_Preferences::Font, "VISU", "scalar_bar_title_font" );
2763 addPreference( tr( "VISU_TITLE" ), fontGr, SalomeApp_Preferences::Color, "VISU", "scalar_bar_title_color" );
2764 int lfont = addPreference( tr( "VISU_LABELS" ), fontGr, SalomeApp_Preferences::Font, "VISU", "scalar_bar_label_font" );
2765 addPreference( tr( "VISU_LABELS" ), fontGr, SalomeApp_Preferences::Color, "VISU", "scalar_bar_label_color" );
2768 fam.append( tr( "VISU_FONT_ARIAL" ) );
2769 fam.append( tr( "VISU_FONT_COURIER" ) );
2770 fam.append( tr( "VISU_FONT_TIMES" ) );
2771 int wflag = ( QtxListResourceEdit::FontItem::All & ( ~( QtxListResourceEdit::FontItem::Size | QtxListResourceEdit::FontItem::UserSize ) ) );
2773 setPreferenceProperty( tfont, "families", fam );
2774 setPreferenceProperty( tfont, "system", false );
2775 setPreferenceProperty( tfont, "widget_flags", wflag );
2776 setPreferenceProperty( lfont, "families", fam );
2777 setPreferenceProperty( lfont, "system", false );
2778 setPreferenceProperty( lfont, "widget_flags", wflag );
2780 int colorsLabelsGr = addPreference( tr( "VISU_COLORS_AND_LABELS" ), sbarTab );
2782 int numcol = addPreference( tr( "VISU_NB_COLORS" ), colorsLabelsGr, SalomeApp_Preferences::IntSpin, "VISU", "scalar_bar_num_colors" );
2783 setPreferenceProperty( numcol, "min", 2 );
2784 setPreferenceProperty( numcol, "max", 64 );
2786 int numlab = addPreference( tr( "VISU_NB_LABELS" ), colorsLabelsGr, SalomeApp_Preferences::IntSpin, "VISU", "scalar_bar_num_labels" );
2787 setPreferenceProperty( numlab, "min", 2 );
2788 setPreferenceProperty( numlab, "max", 65 );
2790 int orientGr = addPreference( tr( "VISU_ORIENTATION" ), sbarTab );
2791 int orient = addPreference( tr( "VISU_ORIENTATION" ), orientGr, SalomeApp_Preferences::Selector, "VISU", "scalar_bar_orientation" );
2792 QStringList orients;
2793 orients.append( tr( "VISU_VERTICAL" ) );
2794 orients.append( tr( "VISU_HORIZONTAL" ) );
2795 QValueList<QVariant> indices;
2796 indices.append( 0 );
2797 indices.append( 1 );
2798 setPreferenceProperty( orient, "strings", orients );
2799 setPreferenceProperty( orient, "indexes", indices );
2801 int posVSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_VERTICAL" ), sbarTab );
2802 int xv = addPreference( tr( "VISU_X" ), posVSizeGr, SalomeApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_x" );
2803 int yv = addPreference( tr( "VISU_Y" ), posVSizeGr, SalomeApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_y" );
2804 int wv = addPreference( tr( "VISU_WIDTH" ), posVSizeGr, SalomeApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_width" );
2805 int hv = addPreference( tr( "VISU_HEIGHT" ), posVSizeGr, SalomeApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_height" );
2806 setPreferenceProperty( xv, "step", 0.1 );
2807 setPreferenceProperty( yv, "step", 0.1 );
2808 setPreferenceProperty( wv, "step", 0.1 );
2809 setPreferenceProperty( hv, "step", 0.1 );
2810 setPreferenceProperty( xv, "min", 0.0 );
2811 setPreferenceProperty( yv, "min", 0.0 );
2812 setPreferenceProperty( wv, "min", 0.0 );
2813 setPreferenceProperty( hv, "min", 0.0 );
2814 setPreferenceProperty( xv, "max", 1.0 );
2815 setPreferenceProperty( yv, "max", 1.0 );
2816 setPreferenceProperty( wv, "max", 1.0 );
2817 setPreferenceProperty( hv, "max", 1.0 );
2819 int posHSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_HORIZONTAL" ), sbarTab );
2820 int xh = addPreference( tr( "VISU_X" ), posHSizeGr, SalomeApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_x" );
2821 int yh = addPreference( tr( "VISU_Y" ), posHSizeGr, SalomeApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_y" );
2822 int wh = addPreference( tr( "VISU_WIDTH" ), posHSizeGr, SalomeApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_width" );
2823 int hh = addPreference( tr( "VISU_HEIGHT" ), posHSizeGr, SalomeApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_height" );
2824 setPreferenceProperty( xh, "step", 0.1 );
2825 setPreferenceProperty( yh, "step", 0.1 );
2826 setPreferenceProperty( wh, "step", 0.1 );
2827 setPreferenceProperty( hh, "step", 0.1 );
2828 setPreferenceProperty( xh, "min", 0.0 );
2829 setPreferenceProperty( yh, "min", 0.0 );
2830 setPreferenceProperty( wh, "min", 0.0 );
2831 setPreferenceProperty( hh, "min", 0.0 );
2832 setPreferenceProperty( xh, "max", 1.0 );
2833 setPreferenceProperty( yh, "max", 1.0 );
2834 setPreferenceProperty( wh, "max", 1.0 );
2835 setPreferenceProperty( hh, "max", 1.0 );
2837 int srangeTab = addPreference( tr( "Scalar range, Sweep, MED import" ) );
2839 int rangeGr = addPreference( tr( "VISU_SCALAR_RANGE" ), srangeTab );
2840 setPreferenceProperty( rangeGr, "columns", 1 );
2842 int mode = addPreference( tr( "VISU_SCALAR_MODE" ), rangeGr, SalomeApp_Preferences::Selector, "VISU", "scalar_bar_mode" );
2844 modes.append( tr( "VISU_MODULUS" ) );
2845 modes.append( tr( "VISU_COMPONENT" ) + tr("1") );
2846 modes.append( tr( "VISU_COMPONENT" ) + tr("2") );
2847 modes.append( tr( "VISU_COMPONENT" ) + tr("3") );
2849 indices.append( 0 );
2850 indices.append( 1 );
2851 indices.append( 2 );
2852 indices.append( 3 );
2853 setPreferenceProperty( mode, "strings", modes );
2854 setPreferenceProperty( mode, "indexes", indices );
2856 addPreference( tr( "VISU_LOGARITHMIC_SCALING" ), rangeGr, SalomeApp_Preferences::Bool, "VISU", "scalar_bar_logarithmic" );
2858 int rangetype = addPreference( tr( "VISU_RANGE_TO_USE" ), rangeGr, SalomeApp_Preferences::Selector, "VISU", "scalar_range_type" );
2860 types.append( tr( "VISU_FIELD_RANGE" ) );
2861 types.append( tr( "VISU_IMPOSED_RANGE" ) );
2863 indices.append( 0 );
2864 indices.append( 1 );
2865 setPreferenceProperty( rangetype, "strings", types );
2866 setPreferenceProperty( rangetype, "indexes", indices );
2868 int imposedGr = addPreference( tr( "VISU_MINMAX_IMPOSED_RANGE" ), srangeTab );
2870 int min = addPreference( tr( "VISU_MIN" ), imposedGr, SalomeApp_Preferences::DblSpin, "VISU", "scalar_range_min" );
2871 int max = addPreference( tr( "VISU_MAX" ), imposedGr, SalomeApp_Preferences::DblSpin, "VISU", "scalar_range_max" );
2872 setPreferenceProperty( min, "step", 0.1 );
2873 setPreferenceProperty( max, "step", 0.1 );
2875 int sweepGr = addPreference( tr( "VISU_SWEEPING_PREF" ), srangeTab );
2876 setPreferenceProperty( sweepGr, "columns", 1 );
2878 int timestep = addPreference( tr( "VISU_TIME_STEP" ), sweepGr, SalomeApp_Preferences::DblSpin, "VISU", "sweeping_time_step" );
2879 int nbcycles = addPreference( tr( "VISU_NB_CYCLES" ), sweepGr, SalomeApp_Preferences::IntSpin, "VISU", "sweeping_number_cycles" );
2880 int nbsteps = addPreference( tr( "VISU_NB_STEPS" ), sweepGr, SalomeApp_Preferences::IntSpin, "VISU", "sweeping_number_steps" );
2881 setPreferenceProperty( timestep, "min", 0.1 );
2882 setPreferenceProperty( timestep, "step", 0.1 );
2883 setPreferenceProperty( timestep, "max", 1000 );
2884 setPreferenceProperty( nbcycles, "max", 100 );
2885 setPreferenceProperty( nbsteps, "max", 200 );
2887 int importGr = addPreference( tr( "MED files import" ), srangeTab );
2888 addPreference( tr( "Full MED loading" ), importGr, SalomeApp_Preferences::Bool, "VISU", "full_med_loading" );
2891 void VisuGUI::preferencesChanged( const QString&, const QString& )
2897 ::getViewManager(const QString& theType,
2898 const bool theIsCreate)
2900 return getApp()->getViewManager(theType,theIsCreate);
2903 SalomeApp_Displayer* VisuGUI::displayer()