From 8ec3d8e2ea140850f0bbfb43033c2c2b036a921a Mon Sep 17 00:00:00 2001 From: ana Date: Wed, 26 Oct 2011 12:24:32 +0000 Subject: [PATCH] Implementation of the "21384: [CEA 508] Plot2d Allow user to rescale curve" isuue. --- src/VISUGUI/VISU_msg_en.ts | 4 +++ src/VISUGUI/VisuGUI.cxx | 45 ++++++++++++++++++++++++++++++++ src/VISUGUI/VisuGUI.h | 1 + src/VISUGUI/VisuGUI_ActionsDef.h | 1 + 4 files changed, 51 insertions(+) diff --git a/src/VISUGUI/VISU_msg_en.ts b/src/VISUGUI/VISU_msg_en.ts index af51cd21..09fd56e1 100644 --- a/src/VISUGUI/VISU_msg_en.ts +++ b/src/VISUGUI/VISU_msg_en.ts @@ -739,6 +739,10 @@ Input value precision can be adjusted using MEN_CURVE_PROPS Properties... + + MEN_CURVE_SCALE + Scale... + MEN_CUT_LINES Cut Lines diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index 2a9b3ebf..c7a8b576 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -74,6 +74,7 @@ #include "VisuGUI_SetupPlot2dDlg.h" #include "Plot2d_SetupCurveDlg.h" #include "Plot2d_ViewManager.h" +#include "Plot2d_SetupCurveScaleDlg.h" #include "QtxPagePrefMgr.h" #include "OB_Browser.h" @@ -1934,6 +1935,44 @@ VisuGUI } } +//---------------------------------------------------------------------------- +void +VisuGUI +::OnCurveScale() +{ + if(IsStudyLocked(GetCStudy(GetAppStudy(this)))) + return; + + VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects( this ); + int nbSel = aSelectionInfo.size(); + QList curList; + bool isValuesEquals = true; + double value; + + for (int i = 0; i < nbSel; i++ ) { + VISU::TSelectionItem aSelectionItem = aSelectionInfo[i]; + VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase; + if(!aBase) + continue; + + if(aBase->GetType() == VISU::TCURVE) + // Curve object + if(VISU::Curve_i* aCurve = dynamic_cast(aBase)) { + curList.append(aCurve); + if( i>0 && isValuesEquals ) + isValuesEquals = (value == aCurve->GetScale()); + value = aCurve->GetScale(); + } + } + + Plot2d_SetupCurveScaleDlg aDlg(GetDesktop( this )); + if( isValuesEquals ) + aDlg.setScale(value); + + if( aDlg.exec() == QDialog::Accepted ) + for ( int i = 0; i < curList.size(); ++i ) + curList.at(i)->SetScale( aDlg.getScale() ); +} //---------------------------------------------------------------------------- void VisuGUI @@ -2624,6 +2663,10 @@ VisuGUI tr("MEN_CURVE_PROPS"), "", 0, aParent, false, this, SLOT(OnCurveProperties())); + createAction( VISU_CURVE_SCALE, tr("MEN_CURVE_SCALE"), QIcon(), + tr("MEN_CURVE_SCALE"), "", 0, aParent, false, + this, SLOT(OnCurveScale())); + createAction( VISU_EDIT_CONTAINER, tr("MEN_EDIT_CONTAINER"), QIcon(), tr("MEN_EDIT_CONTAINER"), "", 0, aParent, false, this, SLOT(OnEditContainer())); @@ -3099,6 +3142,7 @@ VisuGUI 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_CURVE_SCALE ), -1, -1, -1 ); // curve scale mgr->insert( action( VISU_MULTIPR_FULL_RES ), -1, -1, -1 ); mgr->insert( action( VISU_MULTIPR_MED_RES ), -1, -1, -1 ); @@ -3262,6 +3306,7 @@ VisuGUI // Curve commands aRule = "selcount=1 and type='VISU::TCURVE'"; mgr->setRule( action( VISU_CURVE_PROPS ), aRule ); + mgr->setRule( action( VISU_CURVE_SCALE ), "selcount > 0 and type='VISU::TCURVE'"); // Table Commands aRule = "selcount=1 and ( type='VISU::TPOINTMAP3D' or type='VISU::TTABLE')"; diff --git a/src/VISUGUI/VisuGUI.h b/src/VISUGUI/VisuGUI.h index b7b4b4fd..87967ffb 100644 --- a/src/VISUGUI/VisuGUI.h +++ b/src/VISUGUI/VisuGUI.h @@ -169,6 +169,7 @@ protected slots: void OnDeleteObjects(); void OnPlotData(); void OnCurveProperties(); + void OnCurveScale(); void OnClearContainer(); void OnEditContainer(); diff --git a/src/VISUGUI/VisuGUI_ActionsDef.h b/src/VISUGUI/VisuGUI_ActionsDef.h index 972a922c..2f854f15 100644 --- a/src/VISUGUI/VisuGUI_ActionsDef.h +++ b/src/VISUGUI/VisuGUI_ActionsDef.h @@ -65,6 +65,7 @@ #define VISU_COPY_PRS 4037 #define VISU_CURVE_PROPS 4040 +#define VISU_CURVE_SCALE 4041 #define VISU_EDIT_CONTAINER 4042 #define VISU_CLEAR_CONTAINER 4043 -- 2.39.2