From 0b0497c6d1a88044336ee178814c449b292690dd Mon Sep 17 00:00:00 2001 From: jfa Date: Wed, 15 Jun 2005 11:21:07 +0000 Subject: [PATCH] CreateManyMesh, EditPrs, Presentation options, Scaling --- src/VISUGUI/Makefile.in | 9 +- src/VISUGUI/VISU_msg_en.po | 50 ++- src/VISUGUI/VisuGUI.cxx | 509 +++++++++++++++++------- src/VISUGUI/VisuGUI.h | 22 +- src/VISUGUI/VisuGUI_CutLinesDlg.cxx | 14 +- src/VISUGUI/VisuGUI_CutPlanesDlg.cxx | 10 +- src/VISUGUI/VisuGUI_NonIsometricDlg.cxx | 150 ++++--- src/VISUGUI/VisuGUI_NonIsometricDlg.h | 14 +- src/VISUGUI/VisuGUI_StreamLinesDlg.cxx | 2 +- src/VISUGUI/VisuGUI_TimeAnimation.cxx | 2 - src/VISUGUI/VisuGUI_Tools.cxx | 39 ++ src/VISUGUI/VisuGUI_Tools.h | 4 + 12 files changed, 570 insertions(+), 255 deletions(-) diff --git a/src/VISUGUI/Makefile.in b/src/VISUGUI/Makefile.in index 8565754c..a2b001f1 100644 --- a/src/VISUGUI/Makefile.in +++ b/src/VISUGUI/Makefile.in @@ -44,11 +44,8 @@ PO_FILES = \ # Libraries targets LIB = libVISU.la -#LIB_SRC = VisuGUI_SweepPrefDlg.cxx \ -# VisuGUI_NonIsometricDlg.cxx -#LIB_MOC = \ -# VisuGUI_SweepPrefDlg.h \ -# VisuGUI_NonIsometricDlg.h +#LIB_SRC = VisuGUI_SweepPrefDlg.cxx +#LIB_MOC = VisuGUI_SweepPrefDlg.h LIB_SRC = VisuGUI.cxx \ VisuGUI_Selection.cxx \ @@ -59,6 +56,7 @@ LIB_SRC = VisuGUI.cxx \ VisuGUI_CursorDlg.cxx \ VisuGUI_TimeAnimation.cxx \ VisuGUI_EditContainerDlg.cxx \ + VisuGUI_NonIsometricDlg.cxx \ VisuGUI_ScalarBarDlg.cxx \ VisuGUI_DeformedShapeDlg.cxx \ VisuGUI_IsoSurfacesDlg.cxx \ @@ -74,6 +72,7 @@ LIB_MOC = VisuGUI.h \ VisuGUI_CursorDlg.h \ VisuGUI_TimeAnimation.h \ VisuGUI_EditContainerDlg.h \ + VisuGUI_NonIsometricDlg.h \ VisuGUI_ScalarBarDlg.h \ VisuGUI_DeformedShapeDlg.h \ VisuGUI_IsoSurfacesDlg.h \ diff --git a/src/VISUGUI/VISU_msg_en.po b/src/VISUGUI/VISU_msg_en.po index 6694feb1..951f6947 100644 --- a/src/VISUGUI/VISU_msg_en.po +++ b/src/VISUGUI/VISU_msg_en.po @@ -233,6 +233,48 @@ msgstr "Restore view parameters" msgid "VisuGUI::MEN_SAVE_VIEWPARAMS" msgstr "Save view parameters" +msgid "VisuGUI::MEN_COPY_PRS" +msgstr "Copy" + +msgid "VisuGUI::MEN_SELECTION" +msgstr "Selection" + +msgid "VisuGUI::MEN_REPRESENTATION" +msgstr "Representation" + +msgid "VisuGUI::MEN_DISPLAY_SELECTION" +msgstr "Display Selection" + +msgid "VisuGUI::MEN_ERASE_ALL" +msgstr "Erase All" + +msgid "VisuGUI::MEN_SCALING" +msgstr "Scaling" + +msgid "VisuGUI::MEN_GLOBAL_SELECTION" +msgstr "Global Selection" + +msgid "VisuGUI::MEN_PARTIAL_SELECTION" +msgstr "Partial Selection" + +msgid "VisuGUI::DLG_OPACITY_TITLE" +msgstr "Opacity" + +msgid "VisuGUI::DLG_OPACITY_CMT1" +msgstr "Set value between" + +msgid "VisuGUI::DLG_OPACITY_CMT2" +msgstr "0 (transparent) and 100 (opaque)" + +msgid "VisuGUI::DLG_LINEWIDTH_TITLE" +msgstr "Line Width" + +msgid "VisuGUI::DLG_LINEWIDTH_CMT1" +msgstr "Set value between" + +msgid "VisuGUI::DLG_LINEWIDTH_CMT2" +msgstr "1 (thin) and 10 (thick)" + #: VisuGUI_CellsResultsDlg.cxx @@ -281,17 +323,17 @@ msgstr "" #: VisuGUI_CursorDlg.cxx -msgid "VisuGUI_CursorDlg::&Cancel" +msgid "VisuGUI_CursorDlg::&OK" msgstr "" -msgid "VisuGUI_CursorDlg::&OK" +msgid "VisuGUI_CursorDlg::&Cancel" msgstr "" msgid "VisuGUI_CursorDlg::TextLabel1" -msgstr "" +msgstr "Set value between" msgid "VisuGUI_CursorDlg::TextLabel2" -msgstr "" +msgstr "minimal and maximal" #: VisuGUI_CutLinesDlg.cxx diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index bd565d47..984e4a60 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -32,6 +32,7 @@ #include #include +#include #include #include @@ -85,6 +86,7 @@ #include "VisuGUI_Selection.h" #include "VisuGUI_TimeAnimation.h" #include "VisuGUI_EditContainerDlg.h" +#include "VisuGUI_NonIsometricDlg.h" #include "VISU_ScalarMap_i.hh" #include "VisuGUI_ScalarBarDlg.h" @@ -361,22 +363,14 @@ CreatePrs3d(SalomeApp_Module* theModule) aView->onFitAll(); } -void -VisuGUI:: -OnCreateMesh() +void VisuGUI::CreateMesh (const Handle(SALOME_InteractiveObject)& theIO) { _PTR(Study) aStudy = GetCStudy(GetAppStudy(this)); - if (CheckLock(aStudy)) - return; + //if (CheckLock(aStudy)) + // return; - // Get selected SObject - SALOMEDS::SObject_var aResultSObj; - Handle(SALOME_InteractiveObject) anIO; - CORBA::Object_var anObject = GetSelectedObj(this, &anIO); - if (anIO.IsNull() || !anIO->hasEntry()) - return; - - aResultSObj = GetDSStudy(aStudy)->FindObjectID(anIO->getEntry()); + SALOMEDS::SObject_var aResultSObj = + GetDSStudy(aStudy)->FindObjectID(theIO->getEntry()); // Get VISU::Result VISU::Result_var aResult; @@ -452,6 +446,46 @@ OnCreateMesh() } } +void +VisuGUI:: +OnCreateMesh() +{ + _PTR(Study) aStudy = GetCStudy(GetAppStudy(this)); + if (CheckLock(aStudy)) + return; + + // Get selected SObject + SALOMEDS::SObject_var aResultSObj; + Handle(SALOME_InteractiveObject) anIO; + CORBA::Object_var anObject = GetSelectedObj(this, &anIO); + if (anIO.IsNull() || !anIO->hasEntry()) + return; + + CreateMesh(anIO); +} + +void +VisuGUI:: +OnCreateManyMesh() +{ + _PTR(Study) aStudy = GetCStudy(GetAppStudy(this)); + if (CheckLock(aStudy)) + return; + + // Get selected SObject + SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this); + SALOME_ListIO aListIO; + aSelectionMgr->selectedObjects(aListIO); + SALOME_ListIteratorOfListIO anIter (aListIO); + for (; anIter.More(); anIter.Next()) { + Handle(SALOME_InteractiveObject) anIO = anIter.Value(); + if (anIO.IsNull() || !anIO->hasEntry()) + return; + + CreateMesh(anIO); + } +} + void VisuGUI:: OnCreateScalarMap() @@ -502,12 +536,6 @@ OnCreateStreamLines() CreatePrs3d(this); } -void -VisuGUI:: -OnCreateManyMesh() -{ -} - void VisuGUI:: OnCreatePlot2dView() @@ -612,10 +640,96 @@ OnErasePrs() ErasePrs(anObject); } +template +void +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)); + aDlg->initFromPrsObject(aPrsObject); + if (aDlg->exec()) { + if (!(aDlg->storeToPrsObject(aPrsObject))) { + delete aDlg; + return; + } + RecreateActor(theModule, aPrsObject); + if (SVTK_ViewWindow* vw = GetViewWindow(theModule)) { + //if (vw->getRenderer()->GetActors()->GetNumberOfItems() > 0) { + vw->getRenderer()->ResetCameraClippingRange(); + vw->Repaint(); + //} + } + } + delete aDlg; + } +} + void VisuGUI:: OnEditPrs() { + if (CheckLock(GetCStudy(GetAppStudy(this)))) + 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) return; + + switch (aPrs3d->GetType()) { + case VISU::TMESH: + break; + case VISU::TSCALARMAP: + EditPrs3d(this, aPrs3d); + break; + case VISU::TDEFORMEDSHAPE: + EditPrs3d(this, aPrs3d); + break; + case VISU::TCUTPLANES: + EditPrs3d(this, aPrs3d); + /*{ + VISU::CutPlanes_i* aPrsObject = dynamic_cast(aPrs3d); + if (aPrsObject) { + VisuGUI_CutPlanesDlg* aDlg = + new VisuGUI_CutPlanesDlg (GetDesktop(this), false, false); + aDlg->initFromPrsObject(aPrsObject); + aDlg->show(); + } + }*/ + break; + case VISU::TCUTLINES: + EditPrs3d(this, aPrs3d); + /*{ + VISU::CutLines_i* aPrsObject = dynamic_cast(aPrs3d); + if (aPrsObject) { + VisuGUI_CutLinesDlg* aDlg = + new VisuGUI_CutLinesDlg (GetDesktop(this), false, false); + aDlg->initFromPrsObject(aPrsObject); + aDlg->show(); + } + }*/ + break; + case VISU::TISOSURFACE: + EditPrs3d(this, aPrs3d); + break; + case VISU::TVECTORS: + EditPrs3d(this, aPrs3d); + break; + case VISU::TSTREAMLINES: + EditPrs3d(this, aPrs3d); + break; + default: + return; + } + + if (SVTK_ViewWindow* vw = GetViewWindow()) + vw->highlight(anIO, 1); } void @@ -639,15 +753,13 @@ OnDeletePrs() // is it Prs3d object ? VISU::Prs3d_i* aPrsObject = dynamic_cast(VISU::GetServant(anObject).in()); if (aPrsObject) { - //jfa tmp:DeletePresentation(aPrsObject); DeletePrs3d(this, aPrsObject, anIO); } // is it Curve object ? VISU::Curve_i* aCurveObject = dynamic_cast(VISU::GetServant(anObject).in()); if (aCurveObject) { - //jfa tmp:DeletePresentation(aCurveObject); - //DeleteCurve(this, aCurveObject, anIO); + //jfa tmp:DeleteCurve(this, aCurveObject, anIO); } aStudyBuilder->CommitCommand(); @@ -671,52 +783,209 @@ OnDisplayOnlyManyPrs() { } +void +VisuGUI:: +OnEraseAll() +{ + SVTK_ViewWindow* vw = GetViewWindow(); + if (!vw) return; + + /*jfa tmp:GetActiveStudy()->unHighlightAll(); + if (vtkRenderer *aRen = 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); + } + } + vw->Repaint(); + } + } +} + void VisuGUI:: OnMakeSurfaceframe() { + ChangeRepresentation(VISU::SURFACEFRAME); } void VisuGUI:: OnMakeInsideframe() { + ChangeRepresentation(VISU::INSIDEFRAME); } void VisuGUI:: OnMakeWireframe() { + ChangeRepresentation(VISU::WIREFRAME); } void VisuGUI:: OnMakeSurface() { + ChangeRepresentation(VISU::SHADED); } void VisuGUI:: OnMakePoints() { + ChangeRepresentation(VISU::POINT); } void VisuGUI:: OnMakeShrink() { + ChangeRepresentation(VISU::SHRINK); } void VisuGUI:: OnChangeColor() { + 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) return; + + SVTK_ViewWindow* vw = GetViewWindow(); + if (!vw) return; + + VISU_Actor* anActor = GetActor(aPrs3d, vw); + if (!anActor) return; + + VISU::Mesh_i* aMesh = dynamic_cast(aPrs3d); + VISU::DeformedShape_i* aDeformedShape = dynamic_cast(aPrs3d); + SALOMEDS::Color anOldColor, aNewColor; + int aRepresent = anActor->GetRepresentation(); + if (aMesh) { + switch (aRepresent) { + case VISU::POINT : + anOldColor = aMesh->GetNodeColor(); + break; + case VISU::WIREFRAME : + case VISU::INSIDEFRAME : + anOldColor = aMesh->GetLinkColor(); + break; + case VISU::SHADED : + case VISU::SURFACEFRAME : + anOldColor = aMesh->GetCellColor(); + break; + } + } else if (aDeformedShape) { + anOldColor = aDeformedShape->GetColor(); + } else { + return; + } + + QColor aColor (int(255*anOldColor.R), + int(255*anOldColor.G), + int(255*anOldColor.B)); + QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this)); + if (aColorNew.isValid()) { + aNewColor.R = aColorNew.red()/255.; + aNewColor.G = aColorNew.green()/255.; + aNewColor.B = aColorNew.blue()/255.; + if (aMesh) { + switch (aRepresent) { + case VISU::POINT : + aMesh->SetNodeColor(aNewColor); + break; + case VISU::WIREFRAME : + case VISU::INSIDEFRAME : + aMesh->SetLinkColor(aNewColor); + break; + case VISU::SHADED : + case VISU::SURFACEFRAME : + aMesh->SetCellColor(aNewColor); + break; + } + } else { + aDeformedShape->SetColor(aNewColor); + } + RecreateActor(this, aPrs3d); + } } void VisuGUI:: OnChangeWireframeColor() { + 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) return; + + SVTK_ViewWindow* vw = GetViewWindow(); + if (!vw) return; + + VISU_Actor* anActor = GetActor(aPrs3d, vw); + if (!anActor) return; + + if (VISU::Mesh_i* aMesh = dynamic_cast(aPrs3d)) { + SALOMEDS::Color anOldColor = aMesh->GetLinkColor(), aNewColor; + QColor aColor (int(255*anOldColor.R), + int(255*anOldColor.G), + int(255*anOldColor.B)); + QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this)); + if (aColorNew.isValid()) { + aNewColor.R = aColorNew.red()/255.; + aNewColor.G = aColorNew.green()/255.; + aNewColor.B = aColorNew.blue()/255.; + aMesh->SetLinkColor(aNewColor); + RecreateActor(this, aMesh); + } + } } void @@ -729,7 +998,7 @@ OnChangeOpacity() PortableServer::ServantBase_var aServant = VISU::GetServant(anObject); if (!aServant.in()) return; - VISU::ScalarMap_i* aPrsObject = dynamic_cast(aServant.in()); + VISU::Prs3d_i* aPrsObject = dynamic_cast(aServant.in()); if (!aPrsObject) return; SVTK_ViewWindow* vw = GetViewWindow(); @@ -739,10 +1008,10 @@ OnChangeOpacity() if (!anActor) return; VisuGUI_CursorDlg* CursorDlg = - new VisuGUI_CursorDlg (GetDesktop(this), tr("Opacity"), TRUE); + new VisuGUI_CursorDlg (GetDesktop(this), tr("DLG_OPACITY_TITLE"), TRUE); - CursorDlg->Comment1->setText(tr("Set value between")); - CursorDlg->Comment2->setText(tr("0 (transparent) and 100 (opaque)")); + CursorDlg->Comment1->setText(tr("DLG_OPACITY_CMT1")); + CursorDlg->Comment2->setText(tr("DLG_OPACITY_CMT2")); CursorDlg->SpinBox1->setMinValue(0); CursorDlg->SpinBox1->setMaxValue(100); @@ -769,7 +1038,7 @@ OnChangeLines() PortableServer::ServantBase_var aServant = VISU::GetServant(anObject); if (!aServant.in()) return; - VISU::ScalarMap_i* aPrsObject = dynamic_cast(aServant.in()); + VISU::Prs3d_i* aPrsObject = dynamic_cast(aServant.in()); if (!aPrsObject) return; SVTK_ViewWindow* vw = GetViewWindow(); @@ -779,10 +1048,10 @@ OnChangeLines() if (!anActor) return; VisuGUI_CursorDlg* CursorDlg = - new VisuGUI_CursorDlg (GetDesktop(this), tr("Line Width"), TRUE); + new VisuGUI_CursorDlg (GetDesktop(this), tr("DLG_LINEWIDTH_TITLE"), TRUE); - CursorDlg->Comment1->setText("Set value between"); - CursorDlg->Comment2->setText("1 (thin) and 10 (thick)"); + CursorDlg->Comment1->setText("DLG_LINEWIDTH_CMT1"); + CursorDlg->Comment2->setText("DLG_LINEWIDTH_CMT2"); CursorDlg->SpinBox1->setMinValue(1); CursorDlg->SpinBox1->setMaxValue(10); @@ -810,7 +1079,7 @@ VisuGUI:: OnCreateTable() { Handle(SALOME_InteractiveObject) anIO; - CORBA::Object_var anObject = GetSelectedObj( this, &anIO ); + CORBA::Object_var anObject = GetSelectedObj( this, &anIO ); _PTR(Study) aStudy = GetCStudy( GetAppStudy( this ) ); _PTR(SObject) aSObject = aStudy->FindObjectID(anIO->getEntry()); VISU::CutLines_var aCutLines = VISU::CutLines::_narrow( anObject ); @@ -861,7 +1130,6 @@ OnDeleteObject() VISU::Prs3d_var aPrs3d = VISU::Prs3d::_narrow(aChildObj); if (CORBA::is_nil(aPrs3d)) continue; VISU::Prs3d_i* pPrs3d = dynamic_cast(VISU::GetServant(aPrs3d).in()); - //jfa tmp:DeletePresentation(pPrs3d); DeletePrs3d(this, pPrs3d, NULL); } break; @@ -876,7 +1144,7 @@ OnDeleteObject() 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:DeletePresentation(pCurve); + //jfa tmp:DeleteCurve(this, pCurve, NULL); } break; } @@ -925,7 +1193,7 @@ OnPlotData() int horIndex; QValueList verIndices; dlg->getCurvesSource( horIndex, verIndices ); - if ( horIndex >= 0 && verIndices.count() > 0 ) { + 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()); @@ -987,13 +1255,13 @@ OnPlotData() int horIndex; QValueList verIndices; dlg->getCurvesSource( horIndex, verIndices ); - if ( horIndex >= 0 && verIndices.count() > 0 ) { + if ( horIndex >= 0 && verIndices.count() > 0 ) { CORBA::Object_var aTable = GetVisuGen(this)->CreateTable( SO->GetID().c_str() ); CORBA::Object_var aContainer = GetVisuGen(this)->CreateContainer(); if ( !CORBA::is_nil( aTable ) && !CORBA::is_nil( aContainer ) ) { VISU::Table_i* pTable = dynamic_cast(VISU::GetServant(aTable).in()); VISU::Container_i* pContainer = dynamic_cast(VISU::GetServant(aContainer).in()); - + 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 ); @@ -1029,7 +1297,7 @@ OnPlotData() } } delete dlg; - } + } } } @@ -1184,7 +1452,7 @@ OnRename() if (!aSObj) return; //TEST DU PARENT == VISU - _PTR(GenericAttribute) anAttr; + _PTR(GenericAttribute) anAttr; if (aSObj->FindAttribute(anAttr, "AttributeName")) { _PTR(AttributeName) aName (anAttr); QString Name = VisuGUI_NameDlg::getName(GetDesktop(this), aName->Value()); @@ -1247,92 +1515,6 @@ OnRename() } } -/*void -VisuGUI:: -OnRenameTable() -{ - _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this)); - if (CheckLock(aCStudy)) - return; - - Handle(SALOME_InteractiveObject) anIO; - CORBA::Object_var anObject = GetSelectedObj(this, &anIO); - - _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry()); - if (!aSObject) return; - - VISU::Table_i* table = 0; - if (!CORBA::is_nil(anObject)) { - VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject); - if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TTABLE) { - // Table object - CORBA::Object_ptr aTable = VISU::Table::_narrow(anObject); - if (!CORBA::is_nil(aTable)) { - table = dynamic_cast(VISU::GetServant(aTable).in()); - } - } - } - - //TEST DU PARENT == VISU - _PTR(GenericAttribute) anAttr; - if (aSObj->FindAttribute(anAttr, "AttributeName")) { - _PTR(AttributeName) aName (anAttr); - QString Name = SALOMEGUI_NameDlg::getName(GetDesktop(), aName->Value()); - if (!Name.isEmpty()) { - QApplication::setOverrideCursor(Qt::waitCursor); - if (table) - table->SetName(Name.latin1()); - //getApp()->activeStudy()->renameIObject(anIO, Name); - anIO->setName(Name.latin1()); // rename the InteractiveObject - updateObjBrowser(false); - QApplication::restoreOverrideCursor(); - } - } -} - -void -VisuGUI:: -OnRenameContainer() -{ - _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this)); - if (CheckLock(aCStudy)) - return; - - Handle(SALOME_InteractiveObject) anIO; - CORBA::Object_var anObject = GetSelectedObj(this, &anIO); - - _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry()); - if (!aSObject) return; - - VISU::Container_i* container = 0; - if (!CORBA::is_nil(anObject)) { - VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject); - if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TCONTAINER) { - // Container object - CORBA::Object_ptr aContainer = VISU::Container::_narrow(anObject); - if (!CORBA::is_nil(aContainer)) { - container = dynamic_cast(VISU::GetServant(aContainer).in()); - } - } - } - - //TEST DU PARENT == VISU - _PTR(GenericAttribute) anAttr; - if (aSObj->FindAttribute(anAttr, "AttributeName")) { - _PTR(AttributeName) aName (anAttr); - QString Name = SALOMEGUI_NameDlg::getName(QAD_Application::getDesktop(), aName->Value()); - if (!Name.isEmpty()) { - QApplication::setOverrideCursor(Qt::waitCursor); - if (container) - container->SetName(Name.latin1()); - //getApp()->activeStudy()->renameIObject(anIO, Name); - anIO->setName(Name.latin1()); // rename the InteractiveObject - updateObjBrowser(false); - QApplication::restoreOverrideCursor(); - } - } -}*/ - void VisuGUI:: OnSweep() @@ -1512,11 +1694,19 @@ void VisuGUI:: OnSelectionInfo() { - //mySelectionDlg = new VisuGUI_SelectionDlg(); - //mySelectionDlg->show(); (new VisuGUI_SelectionDlg(GetDesktop(this)))->show(); } +void +VisuGUI:: +OnScaling() +{ + VisuGUI_NonIsometricDlg* m_NonIsoDlg = + new VisuGUI_NonIsometricDlg (GetDesktop(this), "m_NonIsoDlg", + false, Qt::WDestructiveClose); + m_NonIsoDlg->show(); +} + void VisuGUI:: initialize( CAM_Application* theApp ) @@ -1740,6 +1930,28 @@ createActions() aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); createAction( 4066, tr("MEN_ANIMATION"), QIconSet(aPixmap), tr("MEN_ANIMATION"), "", 0, aParent, false, this, SLOT(OnTimeAnimation())); + + aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); + createAction( 4070, tr("MEN_ERASE_ALL"), QIconSet(aPixmap), + tr("MEN_ERASE_ALL"), "", 0, aParent, false, + this, SLOT(OnEraseAll())); + + aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); + createAction( 4071, tr("MEN_GLOBAL_SELECTION"), QIconSet(aPixmap), + tr("MEN_GLOBAL_SELECTION"), "", 0, aParent, false, + //this, SLOT(OnEraseAll())); + this); + + aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); + createAction( 4072, tr("MEN_PARTIAL_SELECTION"), QIconSet(aPixmap), + tr("MEN_PARTIAL_SELECTION"), "", 0, aParent, false, + //this, SLOT(OnEraseAll())); + this); + + aPixmap = aResourceMgr->loadPixmap("VISU",tr("")); + createAction( 4073, tr("MEN_SCALING"), QIconSet(aPixmap), + tr("MEN_SCALING"), "", 0, aParent, false, + this, SLOT(OnScaling())); } void @@ -1750,20 +1962,32 @@ createMenus() int aMenuId; aMenuId = createMenu( tr( "MEN_FILE" ), -1 ); createMenu( separator(), aMenuId, 10 ); - createMenu( 112, aMenuId, 10 ); - createMenu( 113, aMenuId, 10 ); - createMenu( 199, aMenuId, 10 ); + createMenu( 112, aMenuId, 10 ); // import from file + createMenu( 113, aMenuId, 10 ); // explore MED file + createMenu( 199, aMenuId, 10 ); // import table aMenuId = createMenu( tr( "MEN_VISUALIZATION" ), -1, -1, 30 ); - //aMenuId = createMenu( tr( "MEN_VISUALIZATION" ), -1, 90 ); - createMenu( 4011, aMenuId, 10 ); - createMenu( 4012, aMenuId, 10 ); - createMenu( 4013, aMenuId, 10 ); - createMenu( 4014, aMenuId, 10 ); - createMenu( 4015, aMenuId, 10 ); - createMenu( 4016, aMenuId, 10 ); - createMenu( 4018, aMenuId, 10 ); - createMenu( 4065, aMenuId, 10 ); + createMenu( 4011, aMenuId, 10 ); // scalar map + createMenu( 4012, aMenuId, 10 ); // deformed shape + createMenu( 4013, aMenuId, 10 ); // vectors + createMenu( 4014, aMenuId, 10 ); // iso surfaces + createMenu( 4015, aMenuId, 10 ); // cut planes + createMenu( 4016, aMenuId, 10 ); // stream lines + createMenu( 4018, aMenuId, 10 ); // cut lines + + aMenuId = createMenu( tr( "MEN_SELECTION" ), -1, -1, 30 ); + createMenu( 4065, aMenuId, 10 ); // selection info + + aMenuId = createMenu( tr( "MEN_REPRESENTATION" ), -1, -1, 30 ); + int parentId = + createMenu( tr( "MEN_DISPLAY_SELECTION" ), aMenuId, 10 ); // display selection + createMenu( 4050, parentId, 10 ); // points + createMenu( 4051, parentId, 10 ); // wireframe + createMenu( 4052, parentId, 10 ); // surface + createMenu( 4070, aMenuId, 10 ); // erase all + createMenu( 4071, aMenuId, 10 ); // global selection + createMenu( 4072, aMenuId, 10 ); // partial selection + createMenu( 4073, aMenuId, 10 ); // scaling } void @@ -1916,11 +2140,12 @@ createPopupMenus() mgr->setRule( action( 4037 ), aRule, true ); // curve commands - aPrsType = "$type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' " - "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'}"; aRule = "selcount=1 and type='VISU::TCURVE'"; mgr->insert( action( 4040 ), -1, -1, -1 ); // curve properties mgr->setRule( action( 4040 ), aRule, true ); + + aPrsType = "$type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' " + "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'}"; aRule = "client='ObjectBrowser' and selcount>1"; mgr->insert( action( 4034 ), -1, -1, -1 ); // display many mgr->setRule( action( 4034 ), aRule + " and (" + aCurveType + " or " + aPrsType + ")", true ); @@ -1938,6 +2163,10 @@ createPopupMenus() mgr->insert( action( 4044 ), -1, -1, -1 ); // clear container mgr->setRule( action( 4044 ), aRule, true ); + aRule = "selcount=1 and "; + mgr->insert( action( 4062 ), -1, -1, -1 ); // edit prs + mgr->setRule( action( 4062 ), aRule + aPrsType, true ); + aRule = "selcount=1 and type='VISU::TCUTLINES' and nbNamedChildren=0"; mgr->insert( action( 4063 ), -1, -1, -1 ); // create table mgr->setRule( action( 4063 ), aRule, true ); diff --git a/src/VISUGUI/VisuGUI.h b/src/VISUGUI/VisuGUI.h index 384d587d..b953d445 100644 --- a/src/VISUGUI/VisuGUI.h +++ b/src/VISUGUI/VisuGUI.h @@ -80,27 +80,29 @@ protected slots: void OnCreateManyMesh(); void OnCreatePlot2dView(); + void OnEditPrs(); + void OnDeletePrs(); + void OnDisplayPrs(); void OnDisplayOnlyPrs(); void OnErasePrs(); - void OnEditPrs(); - void OnDeletePrs(); void OnDisplayManyPrs(); void OnEraseManyPrs(); void OnDisplayOnlyManyPrs(); - + void OnEraseAll(); + void OnMakeSurfaceframe(); void OnMakeInsideframe(); void OnMakeWireframe(); void OnMakeSurface(); void OnMakePoints(); void OnMakeShrink(); - + void OnChangeColor(); void OnChangeWireframeColor(); void OnChangeOpacity(); void OnChangeLines(); - + void OnShowTable(); void OnCreateTable(); void OnDeleteObject(); @@ -108,26 +110,28 @@ protected slots: void OnCurveProperties(); void OnClearContainer(); void OnEditContainer(); - + void OnSaveViewParams(); void OnRestoreViewParams(); void OnDeleteViewParams(); void OnRename(); - //void OnRenameTable(); - //void OnRenameContainer(); void OnSweep(); void OnTimeAnimation(); - + void OnCopyPresentation(); void OnSelectionInfo(); + void OnScaling(); + protected: virtual SalomeApp_Selection* createSelection() const; void ErasePrs (CORBA::Object_ptr theObject); + void ChangeRepresentation (VISU::PresentationType theType); + void CreateMesh (const Handle(SALOME_InteractiveObject)& theIO); private: void createActions(); diff --git a/src/VISUGUI/VisuGUI_CutLinesDlg.cxx b/src/VISUGUI/VisuGUI_CutLinesDlg.cxx index a94e0c0d..36e7abe8 100644 --- a/src/VISUGUI/VisuGUI_CutLinesDlg.cxx +++ b/src/VISUGUI/VisuGUI_CutLinesDlg.cxx @@ -9,12 +9,14 @@ // Module : VISU #include "VisuGUI_CutLinesDlg.h" -#include "VISU_CutLines_i.hh" + #include "VisuGUI.h" + +#include "VISU_Gen_i.hh" +#include "VISU_CutLines_i.hh" + #include "VISU_PipeLine.hxx" -//#include "VTKViewer_ViewWindow.h" #include "VISU_CutLinesPL.hxx" -#include "VISU_Gen_i.hh" #include "SalomeApp_Application.h" #include "SalomeApp_Study.h" @@ -621,10 +623,10 @@ void VisuGUI_CutLinesDlg::accept() MYGenerateTable = myCreateTable->isChecked(); MYGenerateCurve = myCurvesCheck->isChecked(); if (myScalarPane->check()) { - /*((QWidget*)sender())->setDisabled(true); + /*jfa tmp:((QWidget*)sender())->setDisabled(true); storeToPrsObject(myPrs); if (myIsCreation) { - jfa tmp:if (isGenerateTable()) { + if (isGenerateTable()) { visuGUI->GetVisuGen()->CreateTable(myPrs->GetEntry()); if (isGenerateCurves()) { SALOMEDSClient_Study* aStudy = study()->studyDS(); @@ -703,7 +705,7 @@ void VisuGUI_CutLinesDlg::accept() void VisuGUI_CutLinesDlg::reject() { - /*if (myIsCreation) { + /*jfa tmp:if (myIsCreation) { visuGUI->DeletePresentation(myPrs); VisuGUI::application()->objectBrowser()->updateTree(); }*/ diff --git a/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx b/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx index 731cbf69..0614b3c4 100644 --- a/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx +++ b/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx @@ -519,7 +519,7 @@ VisuGUI_CutPlanesDlg::VisuGUI_CutPlanesDlg (QWidget* parent, bool theIsCreation, void VisuGUI_CutPlanesDlg::accept() { if (myScalarPane->check()) QDialog::accept(); -/* +/*jfa tmp: if (myScalarPane->check()) { if (!isModal()) { if (storeToPrsObject(myPrs)) { @@ -555,10 +555,10 @@ void VisuGUI_CutPlanesDlg::accept() { } void VisuGUI_CutPlanesDlg::reject() { - //if (myIsCreation && (!isModal())) { - // visuGUI->DeletePresentation(myPrs); - // VisuGUI::application()->objectBrowser()->updateTree(); - //} + //jfa tmp:if (myIsCreation && (!isModal())) { + //jfa tmp: visuGUI->DeletePresentation(myPrs); + //jfa tmp: VisuGUI::application()->objectBrowser()->updateTree(); + //jfa tmp:} QDialog::reject(); } diff --git a/src/VISUGUI/VisuGUI_NonIsometricDlg.cxx b/src/VISUGUI/VisuGUI_NonIsometricDlg.cxx index 4999cf4b..08cbfbf9 100644 --- a/src/VISUGUI/VisuGUI_NonIsometricDlg.cxx +++ b/src/VISUGUI/VisuGUI_NonIsometricDlg.cxx @@ -5,32 +5,34 @@ // // // File : SALOMEGUI_NonIsometricDlg.cxx -// Author : Vasily Rusyaev +// Author : Vasily Rusyaev // Module : VISU -// $Header$ +// $Header$ #include "VisuGUI_NonIsometricDlg.h" -#include "VisuGUI_Selection.h" -#include "VisuGUI.h" + +#include "VisuGUI_Tools.h" + #include "VISU_Actor.h" #include "VISU_PipeLine.hxx" -#include "QtxDblSpinBox.h" - #include "SalomeApp_Application.h" #include "SalomeApp_SelectionMgr.h" +#include "SVTK_ViewWindow.h" #include "SVTK_RenderWindowInteractor.h" #include "SUIT_Desktop.h" +#include "SUIT_Session.h" #include "SUIT_ViewWindow.h" -#include "VTKViewer_ViewWindow.h" -#include "utilities.h" -#include "SALOME_Selection.h" #include "SALOME_ListIteratorOfListIO.hxx" #include "SALOME_ListIO.hxx" +#include "QtxDblSpinBox.h" + +#include "utilities.h" + #include #include #include @@ -48,44 +50,40 @@ VisuGUI_NonIsometricDlg::VisuGUI_NonIsometricDlg (QWidget* parent, const char* n setName("NonIsometricDlg"); setCaption(tr("DLG_TITLE")); setSizeGripEnabled(TRUE); - - SUIT_ViewWindow* sf = VisuGUI::application()->activeViewManager()->getActiveView(); - VTKViewer_ViewWindow* aViewWnd = dynamic_cast(sf); + + SVTK_ViewWindow* aViewWnd = VISU::GetViewWindow(); // Create layout for this dialog - QGridLayout* layoutDlg = new QGridLayout( this ); + QGridLayout* layoutDlg = new QGridLayout (this); layoutDlg->setSpacing(6); layoutDlg->setMargin(11); - + // Create croup box with grid layout - QGroupBox* GroupBox = new QGroupBox( this, "GroupBox" ); - QGridLayout* glGroupBox = new QGridLayout( GroupBox ); + QGroupBox* GroupBox = new QGroupBox(this, "GroupBox"); + QGridLayout* glGroupBox = new QGridLayout(GroupBox); glGroupBox->setMargin(11); glGroupBox->setSpacing(6); - + // "X" scaling QLabel* TextLabelX = new QLabel (tr("LBL_X"), GroupBox, "TextLabelX"); - m_sbXcoeff = new QtxDblSpinBox( -DBL_MAX, DBL_MAX, 0.1, GroupBox ); -//m_sbXcoeff->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); - m_sbXcoeff->setMinimumWidth( 80 ); - m_sbXcoeff->setValue( 1.0 ); - + m_sbXcoeff = new QtxDblSpinBox(-DBL_MAX, DBL_MAX, 0.1, GroupBox); + m_sbXcoeff->setMinimumWidth(80); + m_sbXcoeff->setValue(1.0); + // "Y" scaling QLabel* TextLabelY = new QLabel (tr("LBL_Y"), GroupBox, "TextLabelY"); - m_sbYcoeff = new QtxDblSpinBox( -DBL_MAX, DBL_MAX, 0.1, GroupBox ); -//m_sbYcoeff->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); - m_sbYcoeff->setMinimumWidth( 80 ); - m_sbYcoeff->setValue( 1.0 ); - + m_sbYcoeff = new QtxDblSpinBox(-DBL_MAX, DBL_MAX, 0.1, GroupBox); + m_sbYcoeff->setMinimumWidth(80); + m_sbYcoeff->setValue(1.0); + // "Z" scaling QLabel* TextLabelZ = new QLabel (tr("LBL_Z"), GroupBox, "TextLabelZ"); - m_sbZcoeff = new QtxDblSpinBox( -DBL_MAX, DBL_MAX, 0.1, GroupBox ); -//m_sbZcoeff->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); - m_sbZcoeff->setMinimumWidth( 80 ); - m_sbZcoeff->setValue( 1.0 ); + m_sbZcoeff = new QtxDblSpinBox(-DBL_MAX, DBL_MAX, 0.1, GroupBox); + m_sbZcoeff->setMinimumWidth(80); + m_sbZcoeff->setValue(1.0); // Get initial values from the current VTK viewer - if ( aViewWnd ) { + if (aViewWnd) { double aScaleFactor[3]; aViewWnd->GetScale(aScaleFactor); m_sbXcoeff -> setValue(aScaleFactor[0]); @@ -94,58 +92,58 @@ VisuGUI_NonIsometricDlg::VisuGUI_NonIsometricDlg (QWidget* parent, const char* n } // Create button - m_bReset = new QPushButton( tr( "&Reset" ), GroupBox, "m_bReset" ); + m_bReset = new QPushButton(tr("&Reset"), GroupBox, "m_bReset"); // Layout widgets in the group box - glGroupBox->addWidget( TextLabelX, 0, 0 ); - glGroupBox->addWidget( m_sbXcoeff, 0, 1 ); - glGroupBox->addWidget( TextLabelY, 0, 2 ); - glGroupBox->addWidget( m_sbYcoeff, 0, 3 ); - glGroupBox->addWidget( TextLabelZ, 0, 4 ); - glGroupBox->addWidget( m_sbZcoeff, 0, 5 ); - glGroupBox->addWidget( m_bReset, 0, 6 ); - + glGroupBox->addWidget(TextLabelX, 0, 0); + glGroupBox->addWidget(m_sbXcoeff, 0, 1); + glGroupBox->addWidget(TextLabelY, 0, 2); + glGroupBox->addWidget(m_sbYcoeff, 0, 3); + glGroupBox->addWidget(TextLabelZ, 0, 4); + glGroupBox->addWidget(m_sbZcoeff, 0, 5); + glGroupBox->addWidget(m_bReset, 0, 6); + // OK, CANCEL, Apply button - QGroupBox* aWgt = new QGroupBox( this ); - QHBoxLayout* aHBoxLayout = new QHBoxLayout( aWgt ); + QGroupBox* aWgt = new QGroupBox(this); + QHBoxLayout* aHBoxLayout = new QHBoxLayout(aWgt); aHBoxLayout->setMargin(11); aHBoxLayout->setSpacing(6); // Create button - QPushButton* m_bOk = new QPushButton( tr( "O&K" ), aWgt, "m_bOk" ); - m_bOk->setDefault( TRUE ); - m_bOk->setAutoDefault( TRUE ); + QPushButton* m_bOk = new QPushButton(tr("O&K"), aWgt, "m_bOk"); + m_bOk->setDefault(TRUE); + m_bOk->setAutoDefault(TRUE); // Create button - QPushButton* m_bApply = new QPushButton( tr( "&Apply" ), aWgt, "m_bApply" ); - m_bApply->setAutoDefault( TRUE ); + QPushButton* m_bApply = new QPushButton(tr("&Apply"), aWgt, "m_bApply"); + m_bApply->setAutoDefault(TRUE); // Create button - QPushButton* m_bCancel = new QPushButton( tr( "&Cancel" ), aWgt, "m_bCancel" ); - m_bCancel->setAutoDefault( TRUE ); + QPushButton* m_bCancel = new QPushButton(tr("&Cancel"), aWgt, "m_bCancel"); + m_bCancel->setAutoDefault(TRUE); // Layout buttons - aHBoxLayout->addWidget( m_bOk ); - aHBoxLayout->addWidget( m_bApply ); + aHBoxLayout->addWidget(m_bOk); + aHBoxLayout->addWidget(m_bApply); aHBoxLayout->addStretch(); - aHBoxLayout->addWidget( m_bCancel ); + aHBoxLayout->addWidget(m_bCancel); // Layout top level widgets layoutDlg->addWidget(GroupBox,0,0); layoutDlg->addWidget(aWgt,1,0); // signals and slots connections - connect( m_bCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); - connect( m_bOk, SIGNAL( clicked() ), this, SLOT( onClickOk( ) ) ); - connect( m_bApply, SIGNAL( clicked() ), this, SLOT( onClickApply( ) ) ); - connect( m_bReset, SIGNAL( clicked() ), this, SLOT( onClickReset( ) ) ); - - this->resize( 100, this->sizeHint().height() ); + connect(m_bCancel, SIGNAL(clicked()), this, SLOT(reject())); + connect(m_bOk, SIGNAL(clicked()), this, SLOT(onClickOk())); + connect(m_bApply, SIGNAL(clicked()), this, SLOT(onClickApply())); + connect(m_bReset, SIGNAL(clicked()), this, SLOT(onClickReset())); + + this->resize(100, this->sizeHint().height()); } -/* +/* * Destroys the object and frees any allocated resources */ VisuGUI_NonIsometricDlg::~VisuGUI_NonIsometricDlg() { - // no need to delete child widgets, Qt does it all for us + // no need to delete child widgets, Qt does it all for us } void VisuGUI_NonIsometricDlg::onClickOk() @@ -156,24 +154,25 @@ void VisuGUI_NonIsometricDlg::onClickOk() accept(); } -void VisuGUI_NonIsometricDlg::onClickApply(){ - SUIT_ViewWindow* sf = VisuGUI::application()->activeViewManager()->getActiveView(); - SalomeApp_SelectionMgr* mgr = VisuGUI::application()->selectionMgr(); - +void VisuGUI_NonIsometricDlg::onClickApply() +{ + SalomeApp_Application* anApp = dynamic_cast + (SUIT_Session::session()->activeApplication()); + SalomeApp_SelectionMgr* mgr = anApp->selectionMgr(); - VTKViewer_ViewWindow* vf = dynamic_cast(sf); - if( !vf ) + SVTK_ViewWindow* vf = VISU::GetViewWindow(); + if (!vf) return; - + double aScale[3] = {m_sbXcoeff->value(), m_sbYcoeff->value(), m_sbZcoeff->value()}; vf->SetScale(aScale); SALOME_ListIO selected; - mgr->selectedObjects( selected ); - SALOME_ListIteratorOfListIO Itinit( selected ); - SVTK_RenderWindowInteractor* rw = dynamic_cast( vf->getRWInteractor() ); + mgr->selectedObjects(selected); + SALOME_ListIteratorOfListIO Itinit(selected); + SVTK_RenderWindowInteractor* rw = dynamic_cast(vf->getRWInteractor()); - if( rw ) + if (rw) for (; Itinit.More(); Itinit.Next()) { rw->highlight(Itinit.Value(), true); } @@ -182,8 +181,7 @@ void VisuGUI_NonIsometricDlg::onClickApply(){ void VisuGUI_NonIsometricDlg::onClickReset() { m_bReset->setFocus(); - m_sbXcoeff->setValue( 1.0 ); - m_sbYcoeff->setValue( 1.0 ); - m_sbZcoeff->setValue( 1.0 ); + m_sbXcoeff->setValue(1.0); + m_sbYcoeff->setValue(1.0); + m_sbZcoeff->setValue(1.0); } - diff --git a/src/VISUGUI/VisuGUI_NonIsometricDlg.h b/src/VISUGUI/VisuGUI_NonIsometricDlg.h index 3c834375..739f87ec 100644 --- a/src/VISUGUI/VisuGUI_NonIsometricDlg.h +++ b/src/VISUGUI/VisuGUI_NonIsometricDlg.h @@ -5,9 +5,9 @@ // // // File : VisuGUI_NonIsometricDlg.h -// Author : Vasily Rusyaev +// Author : Vasily Rusyaev // Module : VISU -// $Header$ +// $Header$ #ifndef VisuGUI_NONISOMETRICDLG_H #define VisuGUI_NONISOMETRICDLG_H @@ -17,18 +17,18 @@ class QtxDblSpinBox; class QPushButton; class VisuGUI_NonIsometricDlg : public QDialog -{ +{ Q_OBJECT - + public: - VisuGUI_NonIsometricDlg( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + VisuGUI_NonIsometricDlg (QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~VisuGUI_NonIsometricDlg(); - + private: QtxDblSpinBox* m_sbXcoeff; QtxDblSpinBox* m_sbYcoeff; QtxDblSpinBox* m_sbZcoeff; - QPushButton* m_bReset ; + QPushButton* m_bReset ; private slots: void onClickApply(); diff --git a/src/VISUGUI/VisuGUI_StreamLinesDlg.cxx b/src/VISUGUI/VisuGUI_StreamLinesDlg.cxx index ed9dfe63..175920eb 100644 --- a/src/VISUGUI/VisuGUI_StreamLinesDlg.cxx +++ b/src/VISUGUI/VisuGUI_StreamLinesDlg.cxx @@ -518,7 +518,7 @@ VISU::Mesh_ptr VisuGUI_StreamLinesDlg::createMesh (VISU::VISUType theType, QStri } if(!CORBA::is_nil(aMesh)){ // Create Actor VISU::Mesh_i* pPresent = dynamic_cast(VISU::GetServant(aMesh).in()); - if(VTKViewer_ViewWindow* vf = VisuGUI::GetVtkViewWindow()){ + if(SVTK_ViewWindow* vf = VISU::GetViewWindow()){ try{ pPresent->SetPresentationType(VISU::POINT); VISU_Actor *anActor = pPresent->CreateActor(); diff --git a/src/VISUGUI/VisuGUI_TimeAnimation.cxx b/src/VISUGUI/VisuGUI_TimeAnimation.cxx index 6c13db26..d5ece609 100644 --- a/src/VISUGUI/VisuGUI_TimeAnimation.cxx +++ b/src/VISUGUI/VisuGUI_TimeAnimation.cxx @@ -37,8 +37,6 @@ #include "SUIT_Desktop.h" #include "SUIT_FileDlg.h" -#include "VTKViewer_ViewWindow.h" - #include #include #include diff --git a/src/VISUGUI/VisuGUI_Tools.cxx b/src/VISUGUI/VisuGUI_Tools.cxx index 2b7f0069..9b3516c5 100644 --- a/src/VISUGUI/VisuGUI_Tools.cxx +++ b/src/VISUGUI/VisuGUI_Tools.cxx @@ -439,6 +439,45 @@ namespace VISU return FindActor(theViewWindow,anEntry.in()); } + void + RecreateActor (const SalomeApp_Module* theModule, + VISU::Prs3d_i* thePrs) + { + QApplication::setOverrideCursor(Qt::waitCursor); + + SALOMEDS::SObject_var aSObject = thePrs->GetSObject(); + CORBA::String_var anEntry = aSObject->GetID(); + + try { + thePrs->Update(); + + TViewWindows aViewWindows = GetViews(theModule); + for (int i = 0, iEnd = aViewWindows.size(); i < iEnd; i++) { + SVTK_ViewWindow* aView = aViewWindows[i]; + if (VISU_Actor* anActor = FindActor(aView, anEntry.in())) { + thePrs->UpdateActor(anActor); + } + } + } catch (std::runtime_error& ex) { + INFOS(ex.what()); + QApplication::restoreOverrideCursor(); + SUIT_MessageBox::warn1 (GetDesktop(theModule), QObject::tr("WRN_VISU"), + QObject::tr("ERR_CANT_BUILD_PRESENTATION") + " " + QObject::tr(ex.what()), + QObject::tr("BUT_OK")); + + TViewWindows aViewWindows = GetViews(theModule); + for (int i = 0, iEnd = aViewWindows.size(); i < iEnd; i++) { + SVTK_ViewWindow* aView = aViewWindows[i]; + if (VISU_Actor* anActor = FindActor(aView, anEntry.in())) { + aView->RemoveActor(anActor); + anActor->Delete(); + } + } + return; + } + QApplication::restoreOverrideCursor(); + } + void Add(SalomeApp_SelectionMgr* theSelectionMgr, const Handle(SALOME_InteractiveObject)& theIO) diff --git a/src/VISUGUI/VisuGUI_Tools.h b/src/VISUGUI/VisuGUI_Tools.h index 296596fc..0f2ac85c 100644 --- a/src/VISUGUI/VisuGUI_Tools.h +++ b/src/VISUGUI/VisuGUI_Tools.h @@ -74,10 +74,14 @@ namespace VISU{ VISU_Actor* UpdateViewer(const SalomeApp_Module* theModule, VISU::Prs3d_i* thePrs, bool theDispOnly = false); + VISU_Actor* FindActor(SVTK_ViewWindow* theViewWindow, const char* theEntry); VISU_Actor* FindActor(SVTK_ViewWindow* theViewWindow, VISU::Prs3d_i* thePrs); + void RecreateActor(const SalomeApp_Module* theModule, + VISU::Prs3d_i* thePrs); + void Add(SalomeApp_SelectionMgr* theSelectionMgr, const Handle(SALOME_InteractiveObject)& theIO); void Remove(SalomeApp_SelectionMgr* theSelectionMgr, -- 2.39.2