From 8e4e64f9bcab994d745b4c327b4aa3add67ed88b Mon Sep 17 00:00:00 2001 From: vsv Date: Thu, 23 Jun 2005 12:51:55 +0000 Subject: [PATCH] Edit curve properties functionality --- src/VISUGUI/VisuGUI.cxx | 79 +++++++++++++++++++++++++++++++++-------- src/VISUGUI/VisuGUI.h | 2 ++ 2 files changed, 66 insertions(+), 15 deletions(-) diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index ba67d348..f6ff55f6 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -55,6 +55,7 @@ #include "SPlot2d_ViewModel.h" #include "SPlot2d_SetupPlot2dDlg.h" +#include "Plot2d_SetupCurveDlg.h" #include "OB_Browser.h" @@ -359,6 +360,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,6 +368,7 @@ 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); @@ -375,7 +378,9 @@ CreatePrs3d(SalomeApp_Module* theModule, 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); @@ -852,21 +857,22 @@ 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(); - } + 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(); } - vw->Repaint(); + } else if (SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(this, false)) { + aPlot2d->EraseAll(); } } @@ -1399,6 +1405,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 @@ -2295,7 +2337,7 @@ VisuGUI:: activateModule( SUIT_Study* theStudy ) { SalomeApp_Module::activateModule( theStudy ); - + studyActivated(); setMenuShown( true ); setToolShown( true ); return true; @@ -2320,6 +2362,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() diff --git a/src/VISUGUI/VisuGUI.h b/src/VISUGUI/VisuGUI.h index 5458d83a..f24d02dd 100644 --- a/src/VISUGUI/VisuGUI.h +++ b/src/VISUGUI/VisuGUI.h @@ -59,6 +59,8 @@ public: virtual void viewManagers( QStringList& ) const; virtual QString engineIOR() const; + virtual void studyActivated(); + public slots: virtual bool deactivateModule( SUIT_Study* ); virtual bool activateModule( SUIT_Study* ); -- 2.39.2