X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FVISUGUI%2FVisuGUI.cxx;h=ced02edf286d7ad476290cd8de1e3e8be76be6a1;hb=a2af64b36f5dc0ef10aea5a727f4504a204a52c4;hp=ba67d34805897add9d37997a06c9125a0afff60c;hpb=74a170fedb988dbf2090ebd2252111dda332f8be;p=modules%2Fvisu.git diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index ba67d348..ced02edf 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -26,18 +26,24 @@ // Module : VISU // $Header$ +#include "VisuGUI.h" + +// STL Includes #include #include #include +// QT Includes #include #include #include +// VTK Includes #include #include #include +// SALOME Includes #include "SALOME_LifeCycleCORBA.hxx" #include "SUIT_ResourceMgr.h" @@ -55,6 +61,7 @@ #include "SPlot2d_ViewModel.h" #include "SPlot2d_SetupPlot2dDlg.h" +#include "Plot2d_SetupCurveDlg.h" #include "OB_Browser.h" @@ -74,10 +81,10 @@ #include "VISU_Result_i.hh" #include "VISU_View_i.hh" #include "VISU_ViewManager_i.hh" +#include "VISU_Plot3D_i.hh" #include "VISU_Actor.h" -#include "VisuGUI.h" #include "VisuGUI_Tools.h" #include "VisuGUI_PopupTools.h" #include "VisuGUI_NameDlg.h" @@ -87,6 +94,10 @@ #include "VisuGUI_TimeAnimation.h" #include "VisuGUI_EditContainerDlg.h" #include "VisuGUI_NonIsometricDlg.h" +#include "VisuGUI_ClippingDlg.h" +#include "VisuGUI_Plot3DDlg.h" +#include "VisuGUI_CubeAxesDlg.h" +#include "VisuGUI_OffsetDlg.h" #include "VISU_ScalarMap_i.hh" #include "VisuGUI_ScalarBarDlg.h" @@ -266,7 +277,49 @@ OnExportTableToFile() if(MYDEBUG) MESSAGE("VisuGUI::OnExportTableToFile()"); } -void +void +VisuGUI:: +OnImportMedField() +{ + _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this)); + if (CheckLock(aCStudy)) + return; + SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy); + + SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this); + SALOME_ListIO aListIO; + aSelectionMgr->selectedObjects(aListIO); + + SALOME_ListIteratorOfListIO It (aListIO); + QApplication::setOverrideCursor(Qt::waitCursor); + for (; It.More(); It.Next()) { + Handle(SALOME_InteractiveObject) anIO = It.Value(); + SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry()); + if (!aSObject->_is_nil()) { + CORBA::Object_var anObject = VISU::SObjectToObject(aSObject); + if (!CORBA::is_nil(anObject)) { + SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject); + if (!CORBA::is_nil(aMED.in())) + GetVisuGen(this)->ImportMed(aSObject); + SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject); + if (!CORBA::is_nil(aField.in())) + GetVisuGen(this)->ImportMedField(aField); + } else { + SALOMEDS::SObject_var aSFather = aSObject->GetFather(); + SALOMEDS::GenericAttribute_var anAttr; + aSFather->FindAttribute(anAttr, "AttributeName"); + SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr); + CORBA::String_var aValue = aName->Value(); + if (strcmp(aValue.in(), "MEDFIELD") == 0) + GetVisuGen(this)->ImportMed(aSObject); + } + } + } + updateObjBrowser(true); + QApplication::restoreOverrideCursor(); +} + +void CreateCurves( SalomeApp_Module* theModule, VISU::CutLines_i* thePrs, QDialog* theDlg, @@ -359,6 +412,7 @@ CreatePrs3d(SalomeApp_Module* theModule, QString anEntity = Storable::FindValue(aMap,"myEntityId",&isExist).latin1(); QString aFieldName = Storable::FindValue(aMap,"myFieldName",&isExist).latin1(); QString aTimeStampId = Storable::FindValue(aMap,"myTimeStampId",&isExist).latin1(); + QApplication::setOverrideCursor(Qt::waitCursor); TPrs3d_i* aPrs3d = CreatePrs3d(theModule, theTimeStamp, @@ -366,16 +420,19 @@ CreatePrs3d(SalomeApp_Module* theModule, (Entity)anEntity.toInt(), aFieldName.latin1(), aTimeStampId.toInt()); + QApplication::restoreOverrideCursor(); if(aPrs3d){ SUIT_ResourceMgr* aResourceMgr = GetResourceMgr(); int aValue = aResourceMgr->integerValue("Visu:BuildDefaultPrs3d",0); if(!aValue){ - if(TDlg* aDlg = new TDlg(GetDesktop(theModule))){ // dialog box in creation mode + if(TDlg* aDlg = new TDlg(theModule)){ // dialog box in creation mode aDlg->initFromPrsObject(aPrs3d); if(IsDlgModal) if(aDlg->exec() && (aDlg->storeToPrsObject(aPrs3d))) { // Optionally, create table and curves for cut lines + QApplication::setOverrideCursor(Qt::waitCursor); CreateCurves( theModule, dynamic_cast( aPrs3d ), aDlg, true ); // in creation mode + QApplication::restoreOverrideCursor(); delete aDlg; } else { DeletePrs3d(theModule,aPrs3d,theIO); @@ -417,89 +474,6 @@ CreatePrs3d(SalomeApp_Module* theModule) aView->onFitAll(); } -void VisuGUI::CreateMesh (const Handle(SALOME_InteractiveObject)& theIO) -{ - _PTR(Study) aStudy = GetCStudy(GetAppStudy(this)); - //if (CheckLock(aStudy)) - // return; - - SALOMEDS::SObject_var aResultSObj = - GetDSStudy(aStudy)->FindObjectID(theIO->getEntry()); - - // Get VISU::Result - VISU::Result_var aResult; - VISU::Result_i* pResult = CheckResult(this, aResultSObj, aResult); - if (pResult == NULL) - return; - - Storable::TRestoringMap aMap = getMapOfValue(aResultSObj); - bool isExist; - string aComment = Storable::FindValue(aMap,"myComment",&isExist).latin1(); - if (!isExist) - return; - - CORBA::Object_var aMesh; - string aMeshName = Storable::FindValue(aMap,"myMeshName").latin1(); -#ifdef CHECKTIME - Utils_Timer timer; - timer.Start(); -#endif - if (aComment == "ENTITY") { - VISU::Entity anEntity = (VISU::Entity)Storable::FindValue(aMap,"myId").toInt(); - if (VISU::Mesh_i::IsPossible(pResult,aMeshName.c_str(),anEntity)) - aMesh = GetVisuGen(this)->MeshOnEntity(aResult,aMeshName.c_str(),anEntity); - } else if (aComment == "FAMILY") { - VISU::Entity anEntity = (VISU::Entity)Storable::FindValue(aMap,"myEntityId").toInt(); - string aFamilyName = Storable::FindValue(aMap,"myName").latin1(); - if (VISU::Mesh_i::IsPossible(pResult,aMeshName.c_str(),anEntity,aFamilyName.c_str())) - aMesh = GetVisuGen(this)->FamilyMeshOnEntity(aResult,aMeshName.c_str(),anEntity,aFamilyName.c_str()); - } else if (aComment == "GROUP") { - string aGroupName = Storable::FindValue(aMap,"myName").latin1(); - if (VISU::Mesh_i::IsPossible(pResult,aMeshName.c_str(),aGroupName.c_str())) - aMesh = GetVisuGen(this)->GroupMesh(aResult,aMeshName.c_str(),aGroupName.c_str()); - } -#ifdef CHECKTIME - timer.Stop(); - MESSAGE("VisuGUI::CreateMesh() - CREATE MESH"); - timer.Show(); -#endif - - QApplication::restoreOverrideCursor(); - VISU::Mesh_i* pPresent = NULL; - if (!CORBA::is_nil(aMesh)) - pPresent = dynamic_cast(VISU::GetServant(aMesh).in()); - if (pPresent == NULL) { - SUIT_MessageBox::warn1 (GetDesktop(this), - tr("VISU_WARNING"), - tr("ERR_CANT_BUILD_PRESENTATION"), - tr("BUT_OK")); - return; - } - - if (SVTK_ViewWindow* aView = GetViewWindow(this)){ - try { -#ifdef CHECKTIME - Utils_Timer timer; - timer.Start(); -#endif - PublishInView(this, pPresent); - aView->onFitAll(); -#ifdef CHECKTIME - timer.Stop(); - MESSAGE("VisuGUI::CreateMesh() - DISPLAY MESH"); - timer.Show(); -#endif - application()->putInfo(QObject::tr("INF_DONE")); - } catch (std::runtime_error& exc) { - INFOS(exc.what()); - SUIT_MessageBox::warn1 (GetDesktop(this), - tr("VISU_WARNING"), - tr("ERR_CANT_CREATE_ACTOR") + " " + tr(exc.what()), - tr("BUT_OK")); - } - } -} - void VisuGUI:: OnCreateMesh() @@ -515,7 +489,7 @@ OnCreateMesh() if (anIO.IsNull() || !anIO->hasEntry()) return; - CreateMesh(anIO); + CreateMesh(this, anIO); } void @@ -536,7 +510,7 @@ OnCreateManyMesh() if (anIO.IsNull() || !anIO->hasEntry()) return; - CreateMesh(anIO); + CreateMesh(this, anIO); } } @@ -590,6 +564,13 @@ OnCreateStreamLines() CreatePrs3d(this); } +void +VisuGUI:: +OnCreatePlot3D() +{ + CreatePrs3d(this); +} + void VisuGUI:: OnCreatePlot2dView() @@ -609,7 +590,7 @@ OnDisplayPrs() SALOME_ListIO aList; SalomeApp_SelectionMgr* mgr = GetSelectionMgr(this); mgr->selectedObjects(aList); - + Handle(SALOME_InteractiveObject) anIO; for ( SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next() ) { anIO = it.Value(); @@ -663,43 +644,6 @@ OnDisplayOnlyPrs() OnDisplayPrs(); } -void VisuGUI::ErasePrs (CORBA::Object_ptr theObject, bool theUpdate) -{ - if (MYDEBUG) MESSAGE("ErasePrs"); - - if ( !CORBA::is_nil( theObject ) ) { - VISU::Base_var aBase = VISU::Base::_narrow(theObject); - if ( CORBA::is_nil( aBase ) ) return; - VISU::VISUType aType = aBase->GetType(); - switch (aType){ - case VISU::TCURVE:{ - if(VISU::Curve_i* aCurve = dynamic_cast(VISU::GetServant(aBase).in())) - PlotCurve(this, aCurve, VISU::eErase ); - break; - } - case VISU::TCONTAINER:{ - if(VISU::Container_i* aContainer = dynamic_cast(VISU::GetServant(aBase).in())) - PlotContainer(this, aContainer, VISU::eErase ); - break; - } - case VISU::TTABLE:{ - if(VISU::Table_i* aTable = dynamic_cast(VISU::GetServant(aBase).in())) - PlotTable(this, aTable, VISU::eErase ); - break; - } - default:{ - if(VISU::Prs3d_i* aPrsObject = dynamic_cast(VISU::GetServant(aBase).in())){ - ErasePrs3d( this, aPrsObject ); - if (theUpdate) { - if (SVTK_ViewWindow* vw = GetViewWindow( this )) - vw->Repaint(); - } - } - } - } // switch (aType) - } -} - void VisuGUI:: OnErasePrs() @@ -707,6 +651,10 @@ OnErasePrs() if(MYDEBUG) MESSAGE("OnErasePrs"); QApplication::setOverrideCursor(Qt::waitCursor); + + SVTK_ViewWindow* vw = GetViewWindow(this); + if (vw) vw->unHighlightAll(); + SALOME_ListIO aList; SalomeApp_SelectionMgr* mgr = GetSelectionMgr(this); mgr->selectedObjects(aList); @@ -715,10 +663,11 @@ OnErasePrs() for ( SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next() ) { anIO = it.Value(); CORBA::Object_var anObject = GetSelectedObj( GetAppStudy(this), anIO->getEntry() ); - ErasePrs(anObject, false); + ErasePrs(this, anObject, false); } - if (SVTK_ViewWindow* vw = GetViewWindow( this )) - vw->Repaint(); + + if (vw) vw->Repaint(); + QApplication::restoreOverrideCursor(); } @@ -729,7 +678,7 @@ EditPrs3d (SalomeApp_Module* theModule, VISU::Prs3d_i* thePrs3d) TPrs3d_i* aPrsObject = dynamic_cast(thePrs3d); if (aPrsObject) { //TDlg* aDlg = new TDlg (GetDesktop(theModule), false, true); - TDlg* aDlg = new TDlg (GetDesktop(theModule)); + TDlg* aDlg = new TDlg (theModule); aDlg->initFromPrsObject(aPrsObject); if (aDlg->exec()) { if (!(aDlg->storeToPrsObject(aPrsObject))) { @@ -806,6 +755,18 @@ OnEditPrs() case VISU::TSTREAMLINES: EditPrs3d(this, aPrs3d); break; + case VISU::TPLOT3D: + EditPrs3d(this, aPrs3d); + /*{ + VISU::Plot3D_i* aPrsObject = dynamic_cast(aPrs3d); + if (aPrsObject) { + VisuGUI_Plot3DDlg* aDlg = new VisuGUI_Plot3DDlg(); + aDlg->initFromPrsObject(aPrsObject); + aDlg->show(); + myActiveDialogBox = aDlg; + } + }*/ + break; default: return; } @@ -814,93 +775,26 @@ OnEditPrs() vw->highlight(anIO, 1); } -void -VisuGUI:: -OnDeletePrs() -{ - _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this)); - if (CheckLock(aCStudy)) - return; - SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy); - - Handle(SALOME_InteractiveObject) anIO; - CORBA::Object_var anObject = GetSelectedObj(this, &anIO); - if (anIO.IsNull()) - return; - - // There is a transaction - SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); - aStudyBuilder->NewCommand(); - - // is it Prs3d object ? - VISU::Prs3d_i* aPrsObject = dynamic_cast(VISU::GetServant(anObject).in()); - if (aPrsObject) { - DeletePrs3d(this, aPrsObject, anIO); - } - - // is it Curve object ? - VISU::Curve_i* aCurveObject = dynamic_cast(VISU::GetServant(anObject).in()); - if (aCurveObject) { - //jfa tmp:DeleteCurve(this, aCurveObject, anIO); - } - - aStudyBuilder->CommitCommand(); -} - - void VisuGUI:: OnEraseAll() { - SVTK_ViewWindow* vw = GetViewWindow(); - if (!vw) return; - - vw->unHighlightAll(); - if (vtkRenderer *aRen = vw->getRenderer()) { - vtkActor *anActor; - vtkActorCollection *anActColl = aRen->GetActors(); - for (anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ) { - if (anActor->GetVisibility() > 0) - if (VISU_Actor* anVISUActor = VISU_Actor::SafeDownCast(anActor)) { - anVISUActor = anVISUActor->GetParent(); - anVISUActor->VisibilityOff(); - } - } - vw->Repaint(); - } -} - -void VisuGUI::ChangeRepresentation (VISU::PresentationType theType) -{ - SVTK_ViewWindow* vw = GetViewWindow(); - if (!vw) return; - - Handle(SALOME_InteractiveObject) anIO; - CORBA::Object_var anObject = GetSelectedObj(this, &anIO); - if (CORBA::is_nil(anObject)) return; - PortableServer::ServantBase_var aServant = VISU::GetServant(anObject); - if (!aServant.in()) return; - - VISU::Prs3d_i* aPrs3d = dynamic_cast(aServant.in()); - if (aPrs3d) { - if (VISU_Actor* anActor = GetActor(aPrs3d, vw)) { - switch (theType) { - case VISU::SHRINK: - if (anActor->IsShrunk()) - anActor->UnShrink(); - else - anActor->SetShrink(); - break; - default: - if (VISU::Mesh_i* aMesh = dynamic_cast(aPrs3d)) { - aMesh->SetPresentationType(theType); - RecreateActor(this, aMesh); - } else { - anActor->SetRepresentation(theType); - } + if (SVTK_ViewWindow* vw = GetViewWindow()) { + vw->unHighlightAll(); + if (vtkRenderer *aRen = vw->getRenderer()) { + vtkActor *anActor; + vtkActorCollection *anActColl = aRen->GetActors(); + for (anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ) { + if (anActor->GetVisibility() > 0) + if (VISU_Actor* anVISUActor = VISU_Actor::SafeDownCast(anActor)) { + anVISUActor = anVISUActor->GetParent(); + anVISUActor->VisibilityOff(); + } } vw->Repaint(); } + } else if (SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(this, false)) { + aPlot2d->EraseAll(); } } @@ -908,42 +802,42 @@ void VisuGUI:: OnMakeSurfaceframe() { - ChangeRepresentation(VISU::SURFACEFRAME); + ChangeRepresentation(this, VISU::SURFACEFRAME); } void VisuGUI:: OnMakeInsideframe() { - ChangeRepresentation(VISU::INSIDEFRAME); + ChangeRepresentation(this, VISU::INSIDEFRAME); } void VisuGUI:: OnMakeWireframe() { - ChangeRepresentation(VISU::WIREFRAME); + ChangeRepresentation(this, VISU::WIREFRAME); } void VisuGUI:: OnMakeSurface() { - ChangeRepresentation(VISU::SHADED); + ChangeRepresentation(this, VISU::SHADED); } void VisuGUI:: OnMakePoints() { - ChangeRepresentation(VISU::POINT); + ChangeRepresentation(this, VISU::POINT); } void VisuGUI:: OnMakeShrink() { - ChangeRepresentation(VISU::SHRINK); + ChangeRepresentation(this, VISU::SHRINK); } void @@ -1115,8 +1009,8 @@ OnChangeLines() VisuGUI_CursorDlg* CursorDlg = new VisuGUI_CursorDlg (GetDesktop(this), tr("DLG_LINEWIDTH_TITLE"), TRUE); - CursorDlg->Comment1->setText("DLG_LINEWIDTH_CMT1"); - CursorDlg->Comment2->setText("DLG_LINEWIDTH_CMT2"); + CursorDlg->Comment1->setText(tr("DLG_LINEWIDTH_CMT1")); + CursorDlg->Comment2->setText(tr("DLG_LINEWIDTH_CMT2")); CursorDlg->SpinBox1->setMinValue(1); CursorDlg->SpinBox1->setMaxValue(10); @@ -1150,7 +1044,7 @@ OnShowTable() SO = GetCStudy( GetAppStudy( this ) )->FindObjectID( table->GetObjectEntry() ); } } - } + } } else { // possibly this is Table SObject SO = GetCStudy( GetAppStudy( this ) )->FindObjectID( anIO->getEntry() ); @@ -1160,10 +1054,10 @@ OnShowTable() return; VisuGUI_TableDlg* dlg = new VisuGUI_TableDlg( GetDesktop( this ), - SO, - false, + SO, + false, //SAL2670 Orientation of show tables - VisuGUI_TableDlg::ttAuto, + VisuGUI_TableDlg::ttAuto, Qt::Vertical ); dlg->show(); } @@ -1185,71 +1079,45 @@ OnCreateTable() void VisuGUI:: -OnDeleteObject() +OnDeleteObjects() { _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this)); if (CheckLock(aCStudy)) return; SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy); + SALOME_ListIO aList; + SalomeApp_SelectionMgr* mgr = GetSelectionMgr(this); + mgr->selectedObjects(aList); + int i = 0, nbSelected = aList.Extent(); + if (nbSelected < 1) return; + + const char* entries [nbSelected]; Handle(SALOME_InteractiveObject) anIO; - CORBA::Object_var anObject = GetSelectedObj(this, &anIO); - if (anIO.IsNull() || !anIO->hasEntry()) - return; + for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) { + anIO = it.Value(); + if (anIO->hasEntry()) + entries[i++] = anIO->getEntry(); + } + nbSelected = i; + if (nbSelected < 1) return; - SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry()); - if (!aSObject->_is_nil()) { - SALOMEDS::ChildIterator_var aChildIter = aStudy->NewChildIterator(aSObject); - for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) { - SALOMEDS::SObject_var aChildSObject = aChildIter->Value(); - CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject); - ErasePrs(aChildObj); - } - SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); - // There is a transaction - aStudyBuilder->NewCommand(); - CORBA::Object_var anObj = VISU::SObjectToObject(aSObject); - if (!CORBA::is_nil(anObj)) { - VISU::Base_var aBase = VISU::Base::_narrow(anObj); - if (!CORBA::is_nil(aBase)) { - VISU::VISUType aType = aBase->GetType(); - switch (aType) { - case VISU::TRESULT: - { - SALOMEDS::ChildIterator_var aChildIter = aStudy->NewChildIterator(aSObject); - for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) { - SALOMEDS::SObject_var aChildSObject = aChildIter->Value(); - CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject); - if (CORBA::is_nil(aChildObj)) continue; - VISU::Prs3d_var aPrs3d = VISU::Prs3d::_narrow(aChildObj); - if (CORBA::is_nil(aPrs3d)) continue; - VISU::Prs3d_i* pPrs3d = dynamic_cast(VISU::GetServant(aPrs3d).in()); - DeletePrs3d(this, pPrs3d, NULL); - } - break; - } - case VISU::TTABLE: - { - SALOMEDS::ChildIterator_var aChildIter = aStudy->NewChildIterator(aSObject); - for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) { - SALOMEDS::SObject_var aChildSObject = aChildIter->Value(); - CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject); - if (CORBA::is_nil(aChildObj)) continue; - CORBA::Object_ptr aCurve = VISU::Curve::_narrow(aChildObj); - if (CORBA::is_nil(aCurve)) continue; - //VISU::Curve_i* pCurve = dynamic_cast(VISU::GetServant(aCurve).in()); - //jfa tmp:DeleteCurve(this, pCurve, NULL); - } - break; - } - } - } + // There is a transaction + SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); + aStudyBuilder->NewCommand(); + + for (i = 0; i < nbSelected; i++) { + SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(entries[i]); + if (!aSObject->_is_nil()) { + DeleteSObject(this, aStudy, aSObject); } - aStudyBuilder->RemoveObjectWithChildren(aSObject); - aStudyBuilder->CommitCommand(); - //jfa tmp:GetActiveStudy()->unHighlightAll(); - updateObjBrowser(true); } + + // Finish transaction + aStudyBuilder->CommitCommand(); + + //GetActiveStudy()->unHighlightAll(); + updateObjBrowser(true); } void @@ -1282,26 +1150,33 @@ OnPlotData() SPlot2d_SetupPlot2dDlg* dlg = new SPlot2d_SetupPlot2dDlg( SO, GetDesktop( this ) ); if ( dlg->exec() == QDialog::Accepted ) { if ( !IsStudyLocked( aStudy ) ) { - // if study is not locked - create new container, create curves - // and insert them into container, then plot container if current viewer is of VIEW_PLOT2D type + // if study is not locked - create new container, create curves and insert them + // into container, then plot container if current viewer is of VIEW_PLOT2D type int horIndex; QValueList verIndices; dlg->getCurvesSource( horIndex, verIndices ); if ( horIndex >= 0 && verIndices.count() > 0 ) { CORBA::Object_var aContainer = GetVisuGen(this)->CreateContainer(); if( !CORBA::is_nil( aContainer ) ) { - VISU::Container_i* pContainer = dynamic_cast(VISU::GetServant(aContainer).in()); + VISU::Container_i* pContainer = + dynamic_cast(VISU::GetServant(aContainer).in()); if ( pContainer ) { for ( int i = 0; i < verIndices.count(); i++ ) { - CORBA::Object_var aNewCurve = GetVisuGen(this)->CreateCurve( table->_this(), horIndex+1, verIndices[i]+1 ); + CORBA::Object_var aNewCurve = + GetVisuGen(this)->CreateCurve( table->_this(), horIndex+1, verIndices[i]+1 ); if( !CORBA::is_nil( aNewCurve ) ) { - VISU::Curve_i* pCrv = dynamic_cast(VISU::GetServant(aNewCurve).in()); + VISU::Curve_i* pCrv = + dynamic_cast(VISU::GetServant(aNewCurve).in()); if ( pCrv ) { bool isAuto; int marker, line, lineWidth; QColor color; - if ( dlg->getCurveAttributes( verIndices[i], isAuto, marker, line, lineWidth, color ) && !isAuto ) { - SALOMEDS::Color c; c.R = color.red()/255.; c.G = color.green()/255.; c.B = color.blue()/255.; + if ( dlg->getCurveAttributes(verIndices[i], isAuto, marker, + line, lineWidth, color) && !isAuto ) { + SALOMEDS::Color c; + c.R = color.red() /255.; + c.G = color.green()/255.; + c.B = color.blue() /255.; pCrv->SetColor( c ); pCrv->SetMarker( ( VISU::Curve::MarkerType )marker ); pCrv->SetLine( ( VISU::Curve::LineType )line, lineWidth ); @@ -1317,7 +1192,8 @@ OnPlotData() } } else { - // if study is locked just get curves info and plot them if current viewer is of VIEW_PLOT2D type + // if study is locked just get curves info and plot them + // if current viewer is of VIEW_PLOT2D type QPtrList container; dlg->getCurves( container ); if ( !container.isEmpty() ) { @@ -1358,15 +1234,20 @@ OnPlotData() if ( pContainer && pTable ) { for ( int i = 0; i < verIndices.count(); i++ ) { - CORBA::Object_var aNewCurve = GetVisuGen(this)->CreateCurve( pTable->_this(), horIndex+1, verIndices[i]+1 ); + CORBA::Object_var aNewCurve = GetVisuGen(this)->CreateCurve + ( pTable->_this(), horIndex+1, verIndices[i]+1 ); if( !CORBA::is_nil( aNewCurve ) ) { VISU::Curve_i* pCrv = dynamic_cast(VISU::GetServant(aNewCurve).in()); if ( pCrv ) { bool isAuto; int marker, line, lineWidth; QColor color; - if ( dlg->getCurveAttributes( verIndices[i], isAuto, marker, line, lineWidth, color ) && !isAuto ) { - SALOMEDS::Color c; c.R = color.red()/255.; c.G = color.green()/255.; c.B = color.blue()/255.; + if ( dlg->getCurveAttributes(verIndices[i], isAuto, marker, + line, lineWidth, color) && !isAuto ) { + SALOMEDS::Color c; + c.R = color.red()/255.; + c.G = color.green()/255.; + c.B = color.blue()/255.; pCrv->SetColor( c ); pCrv->SetMarker( ( VISU::Curve::MarkerType )marker ); pCrv->SetLine( ( VISU::Curve::LineType )line, lineWidth ); @@ -1399,6 +1280,42 @@ void VisuGUI:: OnCurveProperties() { + SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this); + SALOME_ListIO aListIO; + aSelectionMgr->selectedObjects(aListIO); + if (aListIO.Extent() != 1) return; + + SalomeApp_Study* aAppStudy = GetAppStudy(this); + const Handle(SALOME_InteractiveObject)& anIO = aListIO.First(); + CORBA::Object_var anObject = GetSelectedObj( aAppStudy, anIO->getEntry() ); + if (CORBA::is_nil( anObject )) return; + + VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject); + if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TCURVE) { + // Curve object + CORBA::Object_ptr aCurve = VISU::Curve::_narrow( anObject ); + if( !CORBA::is_nil( aCurve ) ) { + VISU::Curve_i* aDSCurve = dynamic_cast(VISU::GetServant(aCurve).in()); + if ( aDSCurve && (!IsStudyLocked( GetCStudy(aAppStudy) )) ) { + Plot2d_SetupCurveDlg aDlg(GetDesktop( this )); + + aDlg.setLine( (int)aDSCurve->GetLine(), aDSCurve->GetLineWidth() ); + aDlg.setMarker( (int)aDSCurve->GetMarker() ); + SALOMEDS::Color aColor = aDSCurve->GetColor(); + aDlg.setColor( QColor( (int)(aColor.R*255.), (int)(aColor.G*255.), (int)(aColor.B*255.) ) ); + if( aDlg.exec() == QDialog::Accepted ) { + aDSCurve->SetLine( (VISU::Curve::LineType)aDlg.getLine(), aDlg.getLineWidth() ); + aDSCurve->SetMarker( (VISU::Curve::MarkerType)aDlg.getMarker()); + SALOMEDS::Color newColor; + newColor.R = aDlg.getColor().red()/255.; + newColor.G = aDlg.getColor().green()/255.; + newColor.B = aDlg.getColor().blue()/255.; + aDSCurve->SetColor( newColor ); + PlotCurve(this, aDSCurve, VISU::eDisplay); + } + } + } + } } void @@ -1499,38 +1416,6 @@ OnRestoreViewParams() VISU::View3D_i::RestoreViewParams(aViewMgr, aSObj->GetName().c_str());//jfa tmp } -void -VisuGUI:: -OnDeleteViewParams() -{ - _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this)); - if (CheckLock(aCStudy)) - return; - SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy); - - Handle(SALOME_InteractiveObject) anIO; - CORBA::Object_var anObject = GetSelectedObj(this, &anIO); - _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry()); - if (!aSObject) return; - - VISU::VISUType aType = (VISU::VISUType)getValue(aSObject, "myType").toInt(); - if (aType == VISU::TVIEW3D) { - SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this); - SALOME_ListIO aListIO, aNewListIO; - aSelectionMgr->selectedObjects(aListIO); - for (SALOME_ListIteratorOfListIO it (aListIO); it.More(); it.Next()) { - if (it.Value()->getEntry() != anIO->getEntry()) { - aNewListIO.Append(it.Value()); - } - } - aSelectionMgr->setSelectedObjects(aNewListIO); - - aCStudy->NewBuilder()->RemoveObject(aSObject); - - updateObjBrowser(); - } -} - void VisuGUI:: OnRename() @@ -1609,6 +1494,13 @@ OnRename() } } +void +VisuGUI:: +OnClippingPlanes() +{ + new VisuGUI_ClippingDlg (this, "", false); +} + void VisuGUI:: OnSweep() @@ -1666,9 +1558,10 @@ void VisuGUI:: OnTimeAnimation() { - _PTR(Study) aStudyDS = GetCStudy(GetAppStudy(this)); + _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this)); VisuGUI_TimeAnimationDlg* aAnimationDlg = - new VisuGUI_TimeAnimationDlg(GetDesktop(this), aStudyDS); +// new VisuGUI_TimeAnimationDlg(GetDesktop(this), aCStudy); + new VisuGUI_TimeAnimationDlg (this, aCStudy); SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this); SALOME_ListIO aListIO; @@ -1678,7 +1571,7 @@ OnTimeAnimation() long aNbTimes = 0; SALOME_ListIteratorOfListIO It (aListIO); for (; It.More(); It.Next()) { - _PTR(SObject) aSObject = aStudyDS->FindObjectID(It.Value()->getEntry()); + _PTR(SObject) aSObject = aCStudy->FindObjectID(It.Value()->getEntry()); if (!aSObject) continue; if (getValue(aSObject, "myComment") == QString("FIELD")) { long aNumber = getValue(aSObject, "myNbTimeStamps").toLong(); @@ -1697,6 +1590,43 @@ OnTimeAnimation() else delete aAnimationDlg; } +//************************************************************************ +void +VisuGUI:: +OnShowAnimation() +{ + SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this); + SALOME_ListIO aListIO; + aSelectionMgr->selectedObjects(aListIO); + + if (aListIO.Extent() != 1) + return; + + const Handle(SALOME_InteractiveObject)& anIO = aListIO.First(); + + _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this)); + + _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry()); + if (!aSObj) return; + + VISU::Storable::TRestoringMap aMap; + _PTR(GenericAttribute) anAttr; + if (!aSObj->FindAttribute(anAttr, "AttributeComment")) return; + + _PTR(AttributeComment) aComment (anAttr); + string aComm = aComment->Value(); + QString strIn (aComm.c_str()); + VISU::Storable::StrToMap(strIn, aMap); + bool isExist; + VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt(); + if (aType != VISU::TANIMATION) return; + + VisuGUI_TimeAnimationDlg* aAnimationDlg = + new VisuGUI_TimeAnimationDlg(this, aCStudy); + aAnimationDlg->restoreFromStudy(aSObj); + aAnimationDlg->show(); +} + void VisuGUI:: OnCopyPresentation() @@ -1705,7 +1635,6 @@ OnCopyPresentation() if (CheckLock(aCStudy)) return; - //VISU::Prs3d_i* aPrsObject = GetSelectedPrs3d(); Handle(SALOME_InteractiveObject) anIO; CORBA::Object_var anObject = GetSelectedObj(this, &anIO); if (CORBA::is_nil(anObject)) return; @@ -1780,6 +1709,14 @@ OnCopyPresentation() UpdateViewer(this, aSameVectors); } break; + case VISU::TPLOT3D: + { + VISU::Plot3D_i* aPlot3DPrs = dynamic_cast(aPrsObject); + VISU::Plot3D_i* aSamePlot3D = new VISU::Plot3D_i(aPlot3DPrs->GetResult()); + aSamePlot3D->SameAs(aPlot3DPrs); + UpdateViewer(this, aSamePlot3D); + } + break; } updateObjBrowser(); } @@ -1788,7 +1725,13 @@ void VisuGUI:: OnSelectionInfo() { - (new VisuGUI_SelectionDlg(GetDesktop(this)))->show(); + if (GetViewWindow()) + (new VisuGUI_SelectionDlg(GetDesktop(this)))->show(); + else + SUIT_MessageBox::warn1(GetDesktop(this), + tr("WRN_VISU"), + tr("ERR_ACTIVATE_VIEW3D"), + tr("BUT_OK") ); } void @@ -1801,6 +1744,166 @@ OnScaling() m_NonIsoDlg->show(); } +void +VisuGUI:: +OnCubeAxes() +{ + //Show dialog that allows to select scale function and corresponding scale factor + VisuGUI_CubeAxesDlg* aDlg = new VisuGUI_CubeAxesDlg (GetDesktop(this)); + aDlg->show(); +} + +void +VisuGUI:: +OnMergeScalarBars() +{ + SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this); + SALOME_ListIO aListIO; + aSelectionMgr->selectedObjects(aListIO); + + SALOME_ListIteratorOfListIO It (aListIO); + + // first find the bounds + double aMin, aMax; bool first = true; + for (; It.More(); It.Next()) { + Handle(SALOME_InteractiveObject)& anIO = It.Value(); + std::vector aPrsList = GetPrs3dList(this, anIO); + if (!aPrsList.empty()) { + for (int i = 0, n = aPrsList.size(); i < n; i++) { + VISU::Prs3d_i* aPrsObject = aPrsList[i]; + if (aPrsObject) { + VISU::ScalarMap_i* aScalar = dynamic_cast(aPrsObject); + if (aScalar) { + if (first) { + first = false; + aMin = aScalar->GetMin(); aMax = aScalar->GetMax(); + } else { + if (aScalar->GetMin() < aMin) aMin = aScalar->GetMin(); + if (aScalar->GetMax() > aMax) aMax = aScalar->GetMax(); + } + } + } + } + } + } + + // set the computed range to every selected ScalarMap + bool update = false; + for (It.Initialize(aListIO); It.More(); It.Next() ) { + Handle(SALOME_InteractiveObject)& anIO = It.Value(); + std::vector aPrsList = GetPrs3dList(this, anIO); + if (!aPrsList.empty()) { + for (int i = 0, n = aPrsList.size(); i < n; i++) { + VISU::Prs3d_i* aPrsObject = aPrsList[i]; + if(aPrsObject){ + VISU::ScalarMap_i* aScalar = dynamic_cast(aPrsObject); + if (aScalar) { + aScalar->SetRange(aMin, aMax); + RecreateActor(this, aScalar); + update = true; + } + } + } + } + } + if (update) { + if (SVTK_ViewWindow* vw = GetViewWindow(this)) { +//if (vw->getRenderer()->GetActors()->GetNumberOfItems() > 0) { + vw->getRenderer()->ResetCameraClippingRange(); + vw->Repaint(); +//} + } + } +} + +void +VisuGUI:: +OnFreeScalarBars() +{ + SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this); + SALOME_ListIO aListIO; + aSelectionMgr->selectedObjects(aListIO); + + SALOME_ListIteratorOfListIO It (aListIO); + + // restore the source range for every ScalarMap + bool update = false; + for (; It.More(); It.Next()) { + Handle(SALOME_InteractiveObject)& anIO = It.Value(); + std::vector aPrsList = GetPrs3dList(this, anIO); + if (!aPrsList.empty()) { + for (int i = 0, n = aPrsList.size(); i < n; i++) { + VISU::Prs3d_i* aPrsObject = aPrsList[i]; + if (aPrsObject) { + VISU::ScalarMap_i* aScalar = dynamic_cast(aPrsObject); + if (aScalar) { + aScalar->SetSourceRange(); + RecreateActor(this, aScalar); + update = true; + } + } + } + } + } + if (update) { + if (SVTK_ViewWindow* vw = GetViewWindow(this)) { +//if (vw->getRenderer()->GetActors()->GetNumberOfItems() > 0) { + vw->getRenderer()->ResetCameraClippingRange(); + vw->Repaint(); +//} + } + } +} + +void +VisuGUI:: +OnTranslatePrs() +{ + if(MYDEBUG) MESSAGE("VisuGUI::OnTranslatePrs"); + VisuGUI_OffsetDlg* aDlg = new VisuGUI_OffsetDlg (this); + + _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this)); + SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy); + + SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this); + SALOME_ListIO aListIO; + aSelectionMgr->selectedObjects(aListIO); + + SALOME_ListIteratorOfListIO It (aListIO); + for (; It.More(); It.Next()) { + Handle(SALOME_InteractiveObject)& anIO = It.Value(); + if (anIO->hasEntry()) { + SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry()); + if (!aSObject->_is_nil()) { + CORBA::Object_var aCORBAObject = VISU::SObjectToObject(aSObject); + if (!CORBA::is_nil(aCORBAObject)) { + PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject); + if (VISU::Prs3d_i* aPrsObject = dynamic_cast(aServant.in())) { + aDlg->addPresentation(aPrsObject); + } + } + } + } + } + if (aDlg->getPrsCount() > 0) + aDlg->show(); + else + delete aDlg; +} + +void +VisuGUI:: +OnArrangeActors() +{ + SVTK_ViewWindow* vw = GetViewWindow(); + if (vw) { + ArrangeDlg* aDlg = new ArrangeDlg (GetDesktop(this), vw); + aDlg->exec(); + delete aDlg; + } +} + + void VisuGUI:: initialize( CAM_Application* theApp ) @@ -1857,183 +1960,229 @@ createActions() createAction( VISU_CUT_LINES, tr("MEN_CUT_LINES"), QIconSet(aPixmap), tr("MEN_CUT_LINES"), "", 0, aParent, false, this, SLOT(OnCreateCutLines())); - aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); - createAction( VISU_PLOT2D, tr("MEN_CREATE_PLOT2D"), QIconSet(aPixmap), tr("MEN_CREATE_PLOT2D"), "", 0, aParent, false, + aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT_3D")); + createAction( VISU_PLOT_3D, tr("MEN_PLOT_3D"), QIconSet(aPixmap), + tr("MEN_PLOT_3D"), "", 0, aParent, false, + this, SLOT(OnCreatePlot3D())); + + aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT2D")); + createAction( VISU_PLOT2D, tr("MEN_CREATE_PLOT2D"), QIconSet(aPixmap), + tr("MEN_CREATE_PLOT2D"), "", 0, aParent, false, this, SLOT(OnCreatePlot2dView())); - aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); - createAction( VISU_DELETE, tr("MEN_DELETE_OBJ"), QIconSet(aPixmap), tr("MEN_DELETE_OBJ"), "", 0, aParent, false, - this, SLOT(OnDeleteObject())); + createAction( VISU_DELETE_OBJS, tr("MEN_DELETE_OBJS"), QIconSet(), + tr("MEN_DELETE_OBJS"), "", 0, aParent, false, + this, SLOT(OnDeleteObjects())); //aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); //createAction( 4022, tr("MEN_RENAME_TABLE"), QIconSet(aPixmap), tr("MEN_RENAME_TABLE"), "", 0, aParent, false, //this, SLOT(OnRenameTable())); - aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); - createAction( VISU_SHOW_TABLE, tr("MEN_SHOW_TABLE"), QIconSet(aPixmap), tr("MEN_SHOW_TABLE"), "", 0, aParent, false, + //aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); + createAction( VISU_SHOW_TABLE, tr("MEN_SHOW_TABLE"), QIconSet(), tr("MEN_SHOW_TABLE"), "", 0, aParent, false, this, SLOT(OnShowTable())); - aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); - createAction( VISU_CREATE_CURVES, tr("MEN_CREATE_CURVES"), QIconSet(aPixmap), tr("MEN_CREATE_CURVES"), "", 0, aParent, false, + //aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); + createAction( VISU_CREATE_CURVES, tr("MEN_CREATE_CURVES"), QIconSet(), tr("MEN_CREATE_CURVES"), "", 0, aParent, false, this, SLOT(OnPlotData())); - aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); - createAction( VISU_EXPORT_TABLE, tr("MEN_EXPORT_TABLE"), QIconSet(aPixmap), tr("MEN_EXPORT_TABLE"), "", 0, aParent, false, + //aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); + createAction( VISU_EXPORT_TABLE, tr("MEN_EXPORT_TABLE"), QIconSet(), tr("MEN_EXPORT_TABLE"), "", 0, aParent, false, this, SLOT(OnExportTableToFile())); - aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); - createAction( VISU_CREATE_PRS, tr("MEN_CREATE_PRS"), QIconSet(aPixmap), tr("MEN_CREATE_PRS"), "", 0, aParent, false, + createAction( VISU_IMPORT_MED_STRUCTURE, tr("MEN_IMPORT_MED_STRUCTURE"), QIconSet(), + tr("MEN_IMPORT_MED_STRUCTURE"), "", 0, aParent, false, + this, SLOT(OnImportMedField())); + + createAction( VISU_IMPORT_MED_TIMESTAMP, tr("MEN_IMPORT_MED_TIMESTAMP"), QIconSet(), + tr("MEN_IMPORT_MED_TIMESTAMP"), "", 0, aParent, false, + this, SLOT(OnImportMedField())); + + createAction( VISU_IMPORT_MED_FIELD, tr("MEN_IMPORT_MED_FIELD"), QIconSet(), + tr("MEN_IMPORT_MED_FIELD"), "", 0, aParent, false, + this, SLOT(OnImportMedField())); + + //aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); + createAction( VISU_CREATE_PRS, tr("MEN_CREATE_PRS"), QIconSet(), tr("MEN_CREATE_PRS"), "", 0, aParent, false, this, SLOT(OnCreateMesh())); - aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); - createAction( VISU_CREATE_MANY_PRS, tr("MEN_CREATE_MANY_PRS"), QIconSet(aPixmap), tr("MEN_CREATE_MANY_PRS"), "", 0, aParent, false, + //aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); + createAction( VISU_CREATE_MANY_PRS, tr("MEN_CREATE_MANY_PRS"), QIconSet(), + tr("MEN_CREATE_MANY_PRS"), "", 0, aParent, false, this, SLOT(OnCreateManyMesh())); - aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); - createAction( VISU_ERASE, tr("MEN_ERASE"), QIconSet(aPixmap), tr("MEN_ERASE"), "", 0, aParent, false, + createAction( VISU_TRANSLATE_PRS, tr("MEN_TRANSLATE_PRS"), QIconSet(), + tr("MEN_TRANSLATE_PRS"), "", 0, aParent, false, + this, SLOT(OnTranslatePrs())); + + createAction( VISU_MERGE_SCALAR_BARS, tr("MEN_MERGE_SCALAR_BARS"), QIconSet(), + tr("MEN_MERGE_SCALAR_BARS"), "", 0, aParent, false, + this, SLOT(OnMergeScalarBars())); + + createAction( VISU_FREE_SCALAR_BARS, tr("MEN_FREE_SCALAR_BARS"), QIconSet(), + tr("MEN_FREE_SCALAR_BARS"), "", 0, aParent, false, + this, SLOT(OnFreeScalarBars())); + + //aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ERASE")); + createAction( VISU_ERASE, tr("MEN_ERASE"), QIconSet(), tr("MEN_ERASE"), "", 0, aParent, false, this, SLOT(OnErasePrs())); - aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); - createAction( VISU_DISPLAY, tr("MEN_DISPLAY"), QIconSet(aPixmap), tr("MEN_DISPLAY"), "", 0, aParent, false, + //aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); + createAction( VISU_DISPLAY, tr("MEN_DISPLAY"), QIconSet(), tr("MEN_DISPLAY"), "", 0, aParent, false, this, SLOT(OnDisplayPrs())); - aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); - createAction( VISU_DISPLAY_ONLY, tr("MEN_DISPLAY_ONLY"), QIconSet(aPixmap), tr("MEN_DISPLAY_ONLY"), "", 0, aParent, false, + //aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); + createAction( VISU_DISPLAY_ONLY, tr("MEN_DISPLAY_ONLY"), QIconSet(), tr("MEN_DISPLAY_ONLY"), "", 0, aParent, false, this, SLOT(OnDisplayOnlyPrs())); - aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); - createAction( VISU_DELETE_PRS, tr("MEN_DELETE_PRS"), QIconSet(aPixmap), tr("MEN_DELETE_PRS"), "", 0, aParent, false, - this, SLOT(OnDeletePrs())); - - aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); - createAction( VISU_COPY_PRS, tr("MEN_COPY_PRS"), QIconSet(aPixmap), tr("MEN_COPY_PRS"), "", 0, aParent, false, + //aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); + createAction( VISU_COPY_PRS, tr("MEN_COPY_PRS"), QIconSet(), tr("MEN_COPY_PRS"), "", 0, aParent, false, this, SLOT(OnCopyPresentation())); - aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); - createAction( VISU_CURVE_PROPS, tr("MEN_CURVE_PROPS"), QIconSet(aPixmap), tr("MEN_CURVE_PROPS"), "", 0, aParent, false, + //aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); + createAction( VISU_CURVE_PROPS, tr("MEN_CURVE_PROPS"), QIconSet(), tr("MEN_CURVE_PROPS"), "", 0, aParent, false, this, SLOT(OnCurveProperties())); - aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); - createAction( VISU_RENAME, tr("MEN_RENAME"), QIconSet(aPixmap), tr("MEN_RENAME"), "", 0, aParent, false, + //aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); + createAction( VISU_RENAME, tr("MEN_RENAME"), QIconSet(), tr("MEN_RENAME"), "", 0, aParent, false, this, SLOT(OnRename())); - aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); - createAction( VISU_EDIT_CONTAINER, tr("MEN_EDIT_CONTAINER"), QIconSet(aPixmap), tr("MEN_EDIT_CONTAINER"), "", 0, aParent, false, + //aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); + createAction( VISU_EDIT_CONTAINER, tr("MEN_EDIT_CONTAINER"), QIconSet(), tr("MEN_EDIT_CONTAINER"), "", 0, aParent, false, this, SLOT(OnEditContainer())); //aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); //createAction( 4043, tr("MEN_RENAME_CONTAINER"), QIconSet(aPixmap), tr("MEN_RENAME_CONTAINER"), "", 0, aParent, false, //this, SLOT(OnRenameContainer())); - aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); - createAction( VISU_CLEAR_CONTAINER, tr("MEN_CLEAR_CONTAINER"), QIconSet(aPixmap), tr("MEN_CLEAR_CONTAINER"), "", 0, aParent, false, + //aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); + createAction( VISU_CLEAR_CONTAINER, tr("MEN_CLEAR_CONTAINER"), QIconSet(), tr("MEN_CLEAR_CONTAINER"), "", 0, aParent, false, this, SLOT(OnClearContainer())); - aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); - createAction( VISU_VIEW_PARAMS, tr("MEN_SAVE_VIEWPARAMS"), QIconSet(aPixmap), + createAction( VISU_SAVE_VIEW_PARAMS, tr("MEN_SAVE_VIEWPARAMS"), QIconSet(), + tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false, + this, SLOT(OnSaveViewParams())); + createAction( VISU_SAVE_VIEW_PARAMS_1, tr("MEN_SAVE_VIEWPARAMS"), QIconSet(), tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false, this, SLOT(OnSaveViewParams())); - aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); - createAction( VISU_RESTORE_VIEW_PARAMS, tr("MEN_RESTORE_VIEWPARAMS"), QIconSet(aPixmap), + //aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); + createAction( VISU_RESTORE_VIEW_PARAMS, tr("MEN_RESTORE_VIEWPARAMS"), QIconSet(), tr("MEN_RESTORE_VIEWPARAMS"), "", 0, aParent, false, this, SLOT(OnRestoreViewParams())); - aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); - createAction( VISU_DELETE_VIEW_PARAMS, tr("MEN_DELETE_VIEWPARAMS"), QIconSet(aPixmap), + createAction( VISU_DELETE_VIEW_PARAMS, tr("MEN_DELETE_VIEWPARAMS"), QIconSet(), tr("MEN_DELETE_VIEWPARAMS"), "", 0, aParent, false, - this, SLOT(OnDeleteViewParams())); + //this, SLOT(OnDeleteViewParams())); + this, SLOT(OnDeleteObjects())); - aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); + createAction( VISU_ARRANGE_ACTORS, tr("MEN_ARRANGE_ACTORS"), QIconSet(), + tr("MEN_ARRANGE_ACTORS"), "", 0, aParent, false, + this, SLOT(OnArrangeActors())); + + aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_POINTS")); createAction( VISU_POINTS, tr("MEN_POINTS"), QIconSet(aPixmap), tr("MEN_POINTS"), "", 0, aParent, false, this, SLOT(OnMakePoints())); - aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); + aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_WIREFRAME")); createAction( VISU_WIREFRAME, tr("MEN_WIREFRAME"), QIconSet(aPixmap), tr("MEN_WIREFRAME"), "", 0, aParent, false, this, SLOT(OnMakeWireframe())); - aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); + aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SURFACE")); createAction( VISU_SURFACE, tr("MEN_SURFACE"), QIconSet(aPixmap), tr("MEN_SURFACE"), "", 0, aParent, false, this, SLOT(OnMakeSurface())); - aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); - createAction( VISU_INSIDEFRAME, tr("MEN_INSIDEFRAME"), QIconSet(aPixmap), tr("MEN_INSIDEFRAME"), "", 0, aParent, false, + //aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); + createAction( VISU_INSIDEFRAME, tr("MEN_INSIDEFRAME"), QIconSet(), tr("MEN_INSIDEFRAME"), "", 0, aParent, false, this, SLOT(OnMakeInsideframe())); - aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); - createAction( VISU_SURFACEFRAME, tr("MEN_SURFACEFRAME"), QIconSet(aPixmap), tr("MEN_SURFACEFRAME"), "", 0, aParent, false, + //aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); + createAction( VISU_SURFACEFRAME, tr("MEN_SURFACEFRAME"), QIconSet(), tr("MEN_SURFACEFRAME"), "", 0, aParent, false, this, SLOT(OnMakeSurfaceframe())); - aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); - createAction( VISU_SHRINK, tr("MEN_SHRINK"), QIconSet(aPixmap), tr("MEN_SHRINK"), "", 0, aParent, false, + //aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); + createAction( VISU_SHRINK, tr("MEN_SHRINK"), QIconSet(), tr("MEN_SHRINK"), "", 0, aParent, false, this, SLOT(OnMakeShrink())); - aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); - createAction( VISU_UNSHRINK, tr("MEN_UNSHRINK"), QIconSet(aPixmap), tr("MEN_UNSHRINK"), "", 0, aParent, false, + //aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); + createAction( VISU_UNSHRINK, tr("MEN_UNSHRINK"), QIconSet(), tr("MEN_UNSHRINK"), "", 0, aParent, false, this, SLOT(OnMakeShrink())); - aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); - createAction( VISU_CELL_COLOR, tr("MEN_CELL_COLOR"), QIconSet(aPixmap), tr("MEN_CELL_COLOR"), "", 0, aParent, false, + //aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); + createAction( VISU_CELL_COLOR, tr("MEN_CELL_COLOR"), QIconSet(), tr("MEN_CELL_COLOR"), "", 0, aParent, false, this, SLOT(OnChangeColor())); - aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); - createAction( VISU_COLOR, tr("MEN_COLOR"), QIconSet(aPixmap), tr("MEN_COLOR"), "", 0, aParent, false, + //aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); + createAction( VISU_COLOR, tr("MEN_COLOR"), QIconSet(), tr("MEN_COLOR"), "", 0, aParent, false, this, SLOT(OnChangeColor())); - aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); - createAction( VISU_EDGE_COLOR, tr("MEN_EDGE_COLOR"), QIconSet(aPixmap), tr("MEN_EDGE_COLOR"), "", 0, aParent, false, + //aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); + createAction( VISU_EDGE_COLOR, tr("MEN_EDGE_COLOR"), QIconSet(), tr("MEN_EDGE_COLOR"), "", 0, aParent, false, this, SLOT(OnChangeWireframeColor())); - aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); - createAction( VISU_OPACITY, tr("MEN_OPACITY"), QIconSet(aPixmap), tr("MEN_OPACITY"), "", 0, aParent, false, + //aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); + createAction( VISU_OPACITY, tr("MEN_OPACITY"), QIconSet(), tr("MEN_OPACITY"), "", 0, aParent, false, this, SLOT(OnChangeOpacity())); - aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); - createAction( VISU_LINE_WIDTH, tr("MEN_LINE_WIDTH"), QIconSet(aPixmap), tr("MEN_LINE_WIDTH"), "", 0, aParent, false, + //aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); + createAction( VISU_LINE_WIDTH, tr("MEN_LINE_WIDTH"), QIconSet(), tr("MEN_LINE_WIDTH"), "", 0, aParent, false, this, SLOT(OnChangeLines())); - aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); - createAction( VISU_EDIT_PRS, tr("MEN_EDIT_PRS"), QIconSet(aPixmap), tr("MEN_EDIT_PRS"), "", 0, aParent, false, + //aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); + createAction( VISU_EDIT_PRS, tr("MEN_EDIT_PRS"), QIconSet(), tr("MEN_EDIT_PRS"), "", 0, aParent, false, this, SLOT(OnEditPrs())); - aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); - createAction( VISU_CREATE_TABLE, tr("MEN_CREATE_TABLE"), QIconSet(aPixmap), tr("MEN_CREATE_TABLE"), "", 0, aParent, false, + //aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); + createAction( VISU_CREATE_TABLE, tr("MEN_CREATE_TABLE"), QIconSet(), tr("MEN_CREATE_TABLE"), "", 0, aParent, false, this, SLOT(OnCreateTable())); - aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); + aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SWEEP")); createAction( VISU_SWEEP, tr("MEN_SWEEP"), QIconSet(aPixmap), tr("MEN_SWEEP"), "", 0, aParent, false, this, SLOT(OnSweep())); - aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); - createAction( VISU_SELECTION_INFO, tr("MEN_SELECTION_INFO"), QIconSet(aPixmap), + createAction( VISU_CLIPPING, tr("MEN_CLIPPING"), QIconSet(), + tr("MEN_CLIPPING"), "", 0, aParent, false, + this, SLOT(OnClippingPlanes())); + + //aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); + createAction( VISU_SELECTION_INFO, tr("MEN_SELECTION_INFO"), QIconSet(), tr("MEN_SELECTION_INFO"), "", 0, aParent, false, this, SLOT(OnSelectionInfo())); - aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); + aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_TIMEANIMATION")); createAction( VISU_ANIMATION, tr("MEN_ANIMATION"), QIconSet(aPixmap), tr("MEN_ANIMATION"), "", 0, aParent, false, this, SLOT(OnTimeAnimation())); - aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); + aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ERASE_ALL")); createAction( VISU_ERASE_ALL, tr("MEN_ERASE_ALL"), QIconSet(aPixmap), tr("MEN_ERASE_ALL"), "", 0, aParent, false, this, SLOT(OnEraseAll())); - aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); + aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_GLOBAL_SELECTION")); createAction( VISU_GLOBAL_SELECTION, tr("MEN_GLOBAL_SELECTION"), QIconSet(aPixmap), tr("MEN_GLOBAL_SELECTION"), "", 0, aParent, false, //this, SLOT(OnEraseAll())); this); - aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); + aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PARTIAL_SELECTION")); createAction( VISU_PARTIAL_SELECTION, tr("MEN_PARTIAL_SELECTION"), QIconSet(aPixmap), tr("MEN_PARTIAL_SELECTION"), "", 0, aParent, false, //this, SLOT(OnEraseAll())); this); - aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); + aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALING")); createAction( VISU_SCALING, tr("MEN_SCALING"), QIconSet(aPixmap), tr("MEN_SCALING"), "", 0, aParent, false, this, SLOT(OnScaling())); + + aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUBE_AXES")); + createAction( VISU_CUBE_AXES, tr("MEN_CUBE_AXES"), QIconSet(aPixmap), + tr("MEN_CUBE_AXES"), "", 0, aParent, false, + this, SLOT(OnCubeAxes())); + + createAction( VISU_SHOW_ANIMATION, tr("MEN_SHOW_ANIMATION"), QIconSet(), + tr("MEN_SHOW_ANIMATION"), "", 0, aParent, false, + this, SLOT(OnShowAnimation())); } void @@ -2042,7 +2191,7 @@ createMenus() { // Add actions to menus int aMenuId; - aMenuId = createMenu( tr( "MEN_FILE" ), -1 ); + aMenuId = createMenu( tr( "MEN_DESK_FILE" ), -1 ); createMenu( separator(), aMenuId, -1, 10 ); createMenu( VISU_IMPORT_FROM_FILE, aMenuId, 10 ); // import from file createMenu( VISU_EXPLORE_MED, aMenuId, 10 ); // explore MED file @@ -2054,8 +2203,9 @@ createMenus() createMenu( VISU_VECTORS, aMenuId, 10 ); // vectors createMenu( VISU_ISO_SURFACES, aMenuId, 10 ); // iso surfaces createMenu( VISU_CUT_PLANES, aMenuId, 10 ); // cut planes - createMenu( VISU_STREAM_LINES, aMenuId, 10 ); // stream lines createMenu( VISU_CUT_LINES, aMenuId, 10 ); // cut lines + createMenu( VISU_STREAM_LINES, aMenuId, 10 ); // stream lines + createMenu( VISU_PLOT_3D, aMenuId, 10 ); // Plot3d aMenuId = createMenu( tr( "MEN_SELECTION" ), -1, -1, 30 ); createMenu( VISU_SELECTION_INFO, aMenuId, 10 ); // selection info @@ -2070,6 +2220,7 @@ createMenus() createMenu( VISU_GLOBAL_SELECTION, aMenuId, 10 ); // global selection createMenu( VISU_PARTIAL_SELECTION, aMenuId, 10 ); // partial selection createMenu( VISU_SCALING, aMenuId, 10 ); // scaling + createMenu( VISU_CUBE_AXES, aMenuId, 10 ); // scaling } void @@ -2082,8 +2233,19 @@ createToolBars() createTool( VISU_VECTORS, aToolId ); createTool( VISU_ISO_SURFACES, aToolId ); createTool( VISU_CUT_PLANES, aToolId ); - createTool( VISU_STREAM_LINES, aToolId ); createTool( VISU_CUT_LINES, aToolId ); + createTool( VISU_STREAM_LINES, aToolId ); + createTool( VISU_PLOT_3D, aToolId ); + + aToolId = createTool(tr("TOOL_REPRESENTATION")); + createTool( VISU_POINTS, aToolId ); + createTool( VISU_WIREFRAME, aToolId ); + createTool( VISU_SURFACE, aToolId ); + createTool( VISU_ERASE_ALL, aToolId ); + createTool( VISU_GLOBAL_SELECTION, aToolId ); + createTool( VISU_PARTIAL_SELECTION, aToolId ); + createTool( VISU_SCALING, aToolId ); + createTool( VISU_CUBE_AXES, aToolId ); } void @@ -2094,181 +2256,302 @@ createPopupMenus() QtxPopupMgr* mgr = popupMgr(); // VISU root commands - QString aRule( "client='ObjectBrowser' and selcount=1 and type='VISU::TVISUGEN'" ); - mgr->insert( action( VISU_IMPORT_FROM_FILE ), -1, -1, -1 ); // import MED + mgr->insert( action( VISU_IMPORT_FROM_FILE ), -1, -1, -1 ); // import MED file + mgr->insert( action( VISU_IMPORT_TABLE ), -1, -1, -1 ); // import tables from file + mgr->insert( action( VISU_PLOT2D ), -1, -1, -1 ); // create Plot2d View + + //mgr->insert( action( VISU_IMPORT_MED ), -1, -1, -1 ); // import MED structure from MED module + + // create + mgr->insert( action( VISU_SCALAR_MAP ), -1, -1, -1 ); // scalar bar + mgr->insert( action( VISU_ISO_SURFACES ), -1, -1, -1 ); // iso surface + mgr->insert( action( VISU_CUT_PLANES ), -1, -1, -1 ); // cut planes + mgr->insert( action( VISU_CUT_LINES ), -1, -1, -1 ); // cut lines + mgr->insert( action( VISU_DEFORMED_SHAPE ), -1, -1, -1 ); // deformed shape + mgr->insert( action( VISU_VECTORS ), -1, -1, -1 ); // vectors + mgr->insert( action( VISU_STREAM_LINES ), -1, -1, -1 ); // stream lines + mgr->insert( action( VISU_PLOT_3D ), -1, -1, -1 ); // Plot3d + + mgr->insert( action( VISU_CREATE_PRS ), -1, -1, -1 ); // create presentation + mgr->insert( action( VISU_CREATE_MANY_PRS ), -1, -1, -1 ); // create presentations + + mgr->insert( action( VISU_CREATE_TABLE ), -1, -1, -1 ); // create table + + // edit + mgr->insert( action( VISU_EDIT_PRS ), -1, -1, -1 ); + mgr->insert( action( VISU_EDIT_CONTAINER ), -1, -1, -1 ); + + // rename + mgr->insert( action( VISU_RENAME ), -1, -1, -1 ); + + // copy + mgr->insert( action( VISU_COPY_PRS ), -1, -1, -1 ); + + // delete + mgr->insert( action( VISU_CLEAR_CONTAINER ), -1, -1, -1 ); + + // table commands + mgr->insert( action( VISU_SHOW_TABLE ), -1, -1, -1 ); // show table + mgr->insert( action( VISU_CREATE_CURVES ), -1, -1, -1 ); // create curves + mgr->insert( action( VISU_EXPORT_TABLE ), -1, -1, -1 ); // export table + + mgr->insert( separator(), -1, -1, -1 ); + + mgr->insert( action( VISU_ERASE ), -1, -1, -1 ); // erase + mgr->insert( action( VISU_DISPLAY ), -1, -1, -1 ); // display + mgr->insert( action( VISU_DISPLAY_ONLY ), -1, -1, -1 ); // display only + + // "Representation" submenu + int parentId = mgr->insert( tr( "MEN_REPRESENTATION" ), -1, -1 ); + mgr->insert( action( VISU_POINTS ) , parentId, -1, -1 ); // points + mgr->insert( action( VISU_WIREFRAME ) , parentId, -1, -1 ); // wireframe + mgr->insert( action( VISU_SURFACE ) , parentId, -1, -1 ); // surface + mgr->insert( action( VISU_INSIDEFRAME ) , parentId, -1, -1 ); // insideframe + mgr->insert( action( VISU_SURFACEFRAME ), parentId, -1, -1 ); // surfaceframe + mgr->insert( action( VISU_SHRINK ) , parentId, -1, -1 ); // shrink + mgr->insert( action( VISU_UNSHRINK ) , parentId, -1, -1 ); // unshrink + + // "Properties" submenu + parentId = mgr->insert( tr( "MEN_PROPERTIES" ), -1, -1 ); + mgr->insert( action( VISU_CELL_COLOR ), parentId, -1, -1 ); // cell color + mgr->insert( action( VISU_EDGE_COLOR ), parentId, -1, -1 ); // edge color + mgr->insert( action( VISU_COLOR ) , parentId, -1, -1 ); // color + mgr->insert( action( VISU_OPACITY ) , parentId, -1, -1 ); // opacity + mgr->insert( action( VISU_LINE_WIDTH ), parentId, -1, -1 ); // line width + + mgr->insert( separator(), -1, -1, -1 ); + + // Other presentations management + mgr->insert( action( VISU_TRANSLATE_PRS ), -1, -1, -1 ); + mgr->insert( action( VISU_CLIPPING ), -1, -1, -1 ); + + mgr->insert( action( VISU_MERGE_SCALAR_BARS ), -1, -1, -1 ); + mgr->insert( action( VISU_FREE_SCALAR_BARS ), -1, -1, -1 ); + + mgr->insert( action( VISU_SWEEP ), -1, -1, -1 ); + mgr->insert( action( VISU_ANIMATION ), -1, -1, -1 ); + + mgr->insert( separator(), -1, -1, -1 ); + + // view parameters commands + mgr->insert( action( VISU_SAVE_VIEW_PARAMS ), -1, -1, -1 ); // save view params + mgr->insert( action( VISU_SAVE_VIEW_PARAMS_1 ), -1, -1, -1 ); // save view params + mgr->insert( action( VISU_RESTORE_VIEW_PARAMS ), -1, -1, -1 ); // restore view params + mgr->insert( action( VISU_DELETE_VIEW_PARAMS ), -1, -1, -1 ); // delete view params + + mgr->insert( action( VISU_ARRANGE_ACTORS ), -1, -1, -1 ); // arrange actors + + mgr->insert( action( VISU_CURVE_PROPS ), -1, -1, -1 ); // curve properties + + mgr->insert( action( VISU_SELECTION_INFO ), -1, -1, -1 ); // Selection info + + // Rules + + QString aSel_One_ObjBr ("client='ObjectBrowser' and selcount=1"); + QString aSel_Some_ObjBr ("client='ObjectBrowser' and selcount>0"); + QString aSel_Many_ObjBr ("client='ObjectBrowser' and selcount>1"); + + QString aPrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' " + "'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D'"); + + QString aCurveAll = "'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER'"; + + // VISU root commands + QString aRule = aSel_One_ObjBr + " and type='VISU::TVISUGEN'"; mgr->setRule( action( VISU_IMPORT_FROM_FILE ), aRule, true ); - mgr->insert( action( VISU_IMPORT_TABLE ), -1, -1, -1 ); // import tables mgr->setRule( action( VISU_IMPORT_TABLE ), aRule, true ); - mgr->insert( action( VISU_PLOT2D ), -1, -1, -1 ); // create Plot2d mgr->setRule( action( VISU_PLOT2D ), aRule, true ); - aRule = "client='ObjectBrowser' and selcount=1 and $type in {'VISU::TRESULT' 'VISU::TTABLE' 'VISU::TCONTAINER'}"; - mgr->insert( action( VISU_DELETE ), -1, -1, -1 ); // delete object - mgr->setRule( action( VISU_DELETE ), aRule, true ); // timestamp commands - aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TTIMESTAMP'"; - mgr->insert( action( VISU_SCALAR_MAP ), -1, -1, -1 ); // scalar bar + aRule = aSel_One_ObjBr + " and type='VISU::TTIMESTAMP'"; mgr->setRule( action( VISU_SCALAR_MAP ), aRule, true ); - mgr->insert( action( VISU_ISO_SURFACES ), -1, -1, -1 ); // iso surface mgr->setRule( action( VISU_ISO_SURFACES ), aRule, true ); - mgr->insert( action( VISU_CUT_PLANES ), -1, -1, -1 ); // cut planes mgr->setRule( action( VISU_CUT_PLANES ), aRule, true ); - mgr->insert( action( VISU_CUT_LINES ), -1, -1, -1 ); // cut lines mgr->setRule( action( VISU_CUT_LINES ), aRule, true ); + mgr->setRule( action( VISU_PLOT_3D ), aRule, true ); aRule += " and nbComponents>1"; - mgr->insert( action( VISU_DEFORMED_SHAPE ), -1, -1, -1 ); // deformed shape mgr->setRule( action( VISU_DEFORMED_SHAPE ), aRule, true ); - mgr->insert( action( VISU_VECTORS ), -1, -1, -1 ); // vectors mgr->setRule( action( VISU_VECTORS ), aRule, true ); - mgr->insert( action( VISU_STREAM_LINES ), -1, -1, -1 ); // stream lines mgr->setRule( action( VISU_STREAM_LINES ), aRule, true ); - aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TTABLE'"; - //mgr->insert( action( 4022 ), -1, -1, -1 ); // rename table - //mgr->setRule( action( 4022 ), aRule, true ); - mgr->insert( action( VISU_SHOW_TABLE ), -1, -1, -1 ); // show table + // table commands + aRule = aSel_One_ObjBr + " and type='VISU::TTABLE'"; mgr->setRule( action( VISU_SHOW_TABLE ), aRule, true ); - mgr->insert( action( VISU_CREATE_CURVES ), -1, -1, -1 ); // create curves mgr->setRule( action( VISU_CREATE_CURVES ), aRule, true ); - mgr->insert( action( VISU_EXPORT_TABLE ), -1, -1, -1 ); // export table mgr->setRule( action( VISU_EXPORT_TABLE ), aRule, true ); - mgr->insert( separator(), -1, -1, -1 ); - aRule = "(client='ObjectBrowser' and selcount>0 and ((type='VISU::TTABLE' and nbChildren>0) " - "or (type='VISU::TCURVE'%1) or (type='VISU::TCONTAINER'))) " - " or (selcount>0 and $type in {" - "'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' " - "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'})"; - mgr->insert( action( VISU_ERASE ), -1, -1, -1 ); // erase - mgr->setRule( action( VISU_ERASE ), aRule.arg(""), true );// TODO: aRule.arg(" and isVisible=1"), true ); - mgr->insert( action( VISU_DISPLAY ), -1, -1, -1 ); // display - mgr->setRule( action( VISU_DISPLAY ), aRule.arg(""), true );// TODO: aRule.arg(" and isVisible=0"), true ); - mgr->insert( action( VISU_DISPLAY_ONLY ), -1, -1, -1 ); // display only - mgr->setRule( action( VISU_DISPLAY_ONLY ), aRule.arg(""), true ); - - aRule = "client='ObjectBrowser' and selcount=1 and $type in {'VISU::TTABLE' " - "'VISU::TCURVE' 'VISU::TCONTAINER' 'VISU::TMESH' 'VISU::TSCALARMAP' " - "'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' " - "'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'}"; - mgr->insert( action( VISU_DELETE_PRS ), -1, -1, -1 ); // delete presentation - mgr->setRule( action( VISU_DELETE_PRS ), aRule, true ); + + aRule = "(" + aSel_Some_ObjBr + " and ((type='VISU::TTABLE' and nbChildren>0) or" + " ($type in {'VISU::TCURVE' 'VISU::TCONTAINER'}))" + ") or (selcount>0 and $type in {'VISU::TMESH' " + aPrsAll + "})"; + + mgr->setRule( action( VISU_ERASE ), aRule + "and (isVisible=true)", true );// TODO: aRule.arg(" and isVisible=1"), true ); + mgr->setRule( action( VISU_DISPLAY ), aRule + "and (isVisible=false)", true );// TODO: aRule.arg(" and isVisible=0"), true ); + mgr->setRule( action( VISU_DISPLAY_ONLY ), aRule, true ); + + aRule = "selcount>0 and $type in {'VISU::TMESH' " + aPrsAll + "}"; + mgr->setRule( action( VISU_TRANSLATE_PRS ), aRule, true ); + + aRule = "selcount>1 and $type in {'VISU::TMESH' " + aPrsAll + "}"; + mgr->setRule( action( VISU_MERGE_SCALAR_BARS ), aRule, true ); + mgr->setRule( action( VISU_FREE_SCALAR_BARS ), aRule, true ); // View parameters - mgr->insert ( action( VISU_VIEW_PARAMS ), -1, -1, -1 ); // save view params - //jfa tmp:mgr->setRule( action( 4046 ), "(client='VTKViewer' and selcount=0) or (selcount=1 and type='VISU::TVIEW3D')", true ); - mgr->setRule( action( VISU_VIEW_PARAMS ), "selcount=0", true ); //jfa tmp - mgr->insert ( action( VISU_RESTORE_VIEW_PARAMS ), -1, -1, -1 ); // restore view params + aRule = "selcount=1 and type='VISU::TVIEW3D'"; + mgr->setRule( action( VISU_SAVE_VIEW_PARAMS_1 ), aRule, true ); + mgr->setRule( action( VISU_SAVE_VIEW_PARAMS ), "client='VTKViewer' and selcount=0", true ); mgr->setRule( action( VISU_RESTORE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D'", true ); - mgr->insert ( action( VISU_DELETE_VIEW_PARAMS ), -1, -1, -1 ); // delete view params mgr->setRule( action( VISU_DELETE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D'", true ); + mgr->setRule( action( VISU_ARRANGE_ACTORS ), "client='VTKViewer' and selcount=0", true ); + // 3D presentations commands - QString aPrsType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' " - "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'}"; + QString aPrsType = " and $type in {'VISU::TMESH' " + aPrsAll + "}"; QString aInsideType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE'}"; QString aSurfType = " and $type in {'VISU::TMESH'}"; - QString aShrinkType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' " - "'VISU::TCUTPLANES' 'VISU::TCUTLINES'}"; + QString aShrinkType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' " + "'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TPLOT3D'}"; QString aLineType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' " - "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TSTREAMLINES'}"; - aRule = "selcount=1"; + "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D'}"; - int parentId = mgr->insert( tr( "MEN_REPRESENTATION" ), -1, -1 ); // "Representation" submenu - mgr->insert( action( VISU_POINTS ), parentId, -1, -1 ); // points - mgr->setRule( action( VISU_POINTS ), aRule + aPrsType + - " and $representation in {'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}", true ); - mgr->insert( action( VISU_WIREFRAME ), parentId, -1, -1 ); // wireframe - mgr->setRule( action( VISU_WIREFRAME ), aRule + aPrsType + - " and $representation in {'VISU::POINT' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}", true ); - mgr->insert( action( VISU_SURFACE ), parentId, -1, -1 ); // surface - mgr->setRule( action( VISU_SURFACE ), aRule + aPrsType + - " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}", true ); - mgr->insert( action( VISU_INSIDEFRAME ), parentId, -1, -1 ); // insideframe - mgr->setRule( action( VISU_INSIDEFRAME ), aRule + aInsideType + - " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::SURFACEFRAME'}", true ); - mgr->insert( action( VISU_SURFACEFRAME ), parentId, -1, -1 ); // surfaceframe - mgr->setRule( action( VISU_SURFACEFRAME ), aRule + aSurfType + - " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}", true ); - mgr->insert( action( VISU_SHRINK ), parentId, -1, -1 ); // shrink - mgr->setRule( action( VISU_SHRINK ), aRule + aShrinkType + " and isShrunk=0", true ); - mgr->insert( action( VISU_UNSHRINK ), parentId, -1, -1 ); // unshrink + aRule = "selcount=1"; + mgr->setRule( action( VISU_CLIPPING ), aRule + aPrsType, true ); + + // "Representation" submenu + QString aNotPoints = " and $representation in {'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}"; + QString aNotWirefr = " and $representation in {'VISU::POINT' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}"; + QString aNotSurfac = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}"; + QString aNotInside = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::SURFACEFRAME'}"; + QString aNotSurffr = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}"; + + mgr->setRule( action( VISU_POINTS ) , aRule + aPrsType + aNotPoints, true ); + mgr->setRule( action( VISU_WIREFRAME ) , aRule + aPrsType + aNotWirefr, true ); + mgr->setRule( action( VISU_SURFACE ) , aRule + aPrsType + aNotSurfac, true ); + mgr->setRule( action( VISU_INSIDEFRAME ) , aRule + aInsideType + aNotInside, true ); + mgr->setRule( action( VISU_SURFACEFRAME ), aRule + aSurfType + aNotSurffr, true ); + + mgr->setRule( action( VISU_SHRINK ) , aRule + aShrinkType + " and isShrunk=0", true ); mgr->setRule( action( VISU_UNSHRINK ), aRule + aShrinkType + " and isShrunk=1", true ); - parentId = mgr->insert( tr( "MEN_PROPERTIES" ), -1, -1 ); // "Properties" submenu - mgr->insert( action( VISU_CELL_COLOR ), parentId, -1, -1 ); // cell color + // "Properties" submenu mgr->setRule( action( VISU_CELL_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'", true ); - mgr->insert( action( VISU_EDGE_COLOR ), parentId, -1, -1 ); // edge color mgr->setRule( action( VISU_EDGE_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'", true ); - mgr->insert( action( VISU_COLOR ), parentId, -1, -1 ); // color mgr->setRule( action( VISU_COLOR ), aRule + " and ((type='VISU::TMESH'" " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}) " "or (type='VISU::TDEFORMEDSHAPE' and hasActor=1))", true ); - mgr->insert( action( VISU_OPACITY ), parentId, -1, -1 ); // opacity mgr->setRule( action( VISU_OPACITY ), aRule + aShrinkType + " and hasActor=1", true ); - mgr->insert( action( VISU_LINE_WIDTH ), parentId, -1, -1 ); // line width mgr->setRule( action( VISU_LINE_WIDTH ), aRule + aLineType + " and hasActor=1", true ); // rename command - QString aCurveType = "$type in {'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER'}"; - aPrsType = "$type in {'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' " - "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'}"; - - aRule = "selcount=1 and (type=VISU::TVIEW3D or " + aCurveType + " or " + aPrsType + ")"; - mgr->insert ( action( VISU_RENAME ), -1, -1, -1 ); // rename + aRule = "selcount=1 and ($type in {'VISU::TVIEW3D' " + aCurveAll + " " + aPrsAll + "})"; mgr->setRule( action( VISU_RENAME ), aRule, true ); // copy presentation command - aRule = "selcount=1 and " + aPrsType; - mgr->insert ( action( VISU_COPY_PRS ), -1, -1, -1 ); // copy + aRule = "selcount=1 and ($type in {" + aPrsAll + "})"; mgr->setRule( action( VISU_COPY_PRS ), aRule, true ); // curve commands aRule = "selcount=1 and type='VISU::TCURVE'"; - mgr->insert( action( VISU_CURVE_PROPS ), -1, -1, -1 ); // curve properties mgr->setRule( action( VISU_CURVE_PROPS ), aRule, true ); // curve container commands - aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TCONTAINER'"; - mgr->insert( action( VISU_EDIT_CONTAINER ), -1, -1, -1 ); // edit container + aRule = aSel_One_ObjBr + " and type='VISU::TCONTAINER'"; mgr->setRule( action( VISU_EDIT_CONTAINER ), aRule, true ); - //mgr->insert( action( 4043 ), -1, -1, -1 ); // rename container - //mgr->setRule( action( 4043 ), aRule, true ); - mgr->insert( action( VISU_CLEAR_CONTAINER ), -1, -1, -1 ); // clear container mgr->setRule( action( VISU_CLEAR_CONTAINER ), aRule, true ); - aRule = "selcount=1 and "; - mgr->insert( action( VISU_EDIT_PRS ), -1, -1, -1 ); // edit prs - mgr->setRule( action( VISU_EDIT_PRS ), aRule + aPrsType, true ); + aRule = "selcount=1 and $type in {" + aPrsAll + "}"; + mgr->setRule( action( VISU_EDIT_PRS ), aRule, true ); aRule = "selcount=1 and type='VISU::TCUTLINES' and nbNamedChildren=0"; - mgr->insert( action( VISU_CREATE_TABLE ), -1, -1, -1 ); // create table mgr->setRule( action( VISU_CREATE_TABLE ), aRule, true ); - aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TSCALARMAP'"; - mgr->insert ( action( VISU_SWEEP ), -1, -1, -1 ); // sweep + aRule = "selcount=1 and type='VISU::TSCALARMAP'"; mgr->setRule( action( VISU_SWEEP ), aRule, true ); // Selection info popup item - aRule = "client='ObjectBrowser' and selcount=1" + aInsideType; - mgr->insert( action( VISU_SELECTION_INFO ), -1, -1, -1 ); // Selection info + aRule = "client='VTKViewer' and selcount=1" + aInsideType; mgr->setRule( action( VISU_SELECTION_INFO ), aRule, true ); aRule = "client='ObjectBrowser' and selcount>0 and $type in {'VISU::TFIELD'} and nbTimeStamps>1"; - mgr->insert( action( VISU_ANIMATION ), -1, -1, -1 ); // animation mgr->setRule( action( VISU_ANIMATION ), aRule, true ); aRule = "client='ObjectBrowser' and $type in {'VISU::TENTITY' 'VISU::TFAMILY' 'VISU::TGROUP'}"; - mgr->insert( action( VISU_CREATE_PRS ), -1, -1, -1 ); // create presentation mgr->setRule( action( VISU_CREATE_PRS ), aRule + " and selcount=1", true ); - mgr->insert( action( VISU_CREATE_MANY_PRS ), -1, -1, -1 ); // create presentations mgr->setRule( action( VISU_CREATE_MANY_PRS ), aRule + " and selcount>1", true ); + + //aRule = "client='ObjectBrowser' and type='MEDFIELD'"; + //mgr->setRule( action( VISU_IMPORT_MED ), aRule, true ); } +//*************************************************************************** +void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, QString& theTitle ) +{ + SalomeApp_Module::contextMenuPopup(theClient, theMenu, theTitle); + + // Check if some (nb > 0) removable objects selected + if (IsRemovableSelected(this)) { + action( VISU_DELETE_OBJS )->addTo(theMenu); + } + + // Check single selection + SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this); + SALOME_ListIO aListIO; + aSelectionMgr->selectedObjects(aListIO); + if (aListIO.Extent() != 1) return; + + Handle(SALOME_InteractiveObject) anIO; + VISU::Storable::TRestoringMap aMap; + CORBA::Object_var anObject = GetSelectedObj( this, &anIO, &aMap); + + _PTR(SObject) SO = GetCStudy(GetAppStudy(this))->FindObjectID(anIO->getEntry()); + bool isExist; + VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt(); + + if (aType == VISU::TANIMATION) { + action( VISU_SHOW_ANIMATION )->addTo(theMenu); + + } else if (IsSObjectTable(SO)) { + action( VISU_SHOW_TABLE )->addTo(theMenu); + action( VISU_CREATE_CURVES )->addTo(theMenu); + action( VISU_EXPORT_TABLE )->addTo(theMenu); + theMenu->insertSeparator(); + + } else { + if (!CORBA::is_nil(anObject)) { + SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject); + if (!CORBA::is_nil(aMED.in())) { + action( VISU_IMPORT_MED_STRUCTURE )->addTo(theMenu); + } + + SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject); // "Import Structure" + if (!CORBA::is_nil(aField)) { + action( VISU_IMPORT_MED_TIMESTAMP )->addTo(theMenu); // "Import TimeStamp" + } + } else { + _PTR(SObject) aSFather = SO->GetFather(); + if (aSFather) { + _PTR(GenericAttribute) anAttr; + aSFather->FindAttribute(anAttr, "AttributeName"); + if (anAttr) { + _PTR(AttributeName) aName (anAttr); + std::string aValue = aName->Value(); + if (strcmp(aValue.c_str(), "MEDFIELD") == 0) { + action( VISU_IMPORT_MED_FIELD )->addTo(theMenu); // "Import Field" + } + } + } + } + } +} + + +//*************************************************************************** void VisuGUI:: windows( QMap& theMap ) const { theMap.clear(); theMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::DockLeft ); + theMap.insert( SalomeApp_Application::WT_PyConsole, Qt::DockBottom ); } @@ -2295,7 +2578,7 @@ VisuGUI:: activateModule( SUIT_Study* theStudy ) { SalomeApp_Module::activateModule( theStudy ); - + studyActivated(); setMenuShown( true ); setToolShown( true ); return true; @@ -2320,6 +2603,13 @@ createSelection() const return new VisuGUI_Selection( (SalomeApp_Module*)this ); } +//****************************************************************** +void VisuGUI::studyActivated() +{ + GetVisuGen(this)->SetCurrentStudy(GetDSStudy(GetCStudy(GetAppStudy(this)))); +} + + extern "C" { CAM_Module* createModule()