From 01bd9bd21c3f47b48f66e7690f4e070ee3831b9b Mon Sep 17 00:00:00 2001 From: enk Date: Thu, 20 Oct 2005 14:06:28 +0000 Subject: [PATCH] Fix for Bug PAL8856 set axis scale not available from TUI --- idl/VISU_Gen.idl | 16 ++++++++++++ src/VISU_I/VISU_View_i.cc | 53 +++++++++++++++++++++++++++++++++++++++ src/VISU_I/VISU_View_i.hh | 5 ++++ 3 files changed, 74 insertions(+) diff --git a/idl/VISU_Gen.idl b/idl/VISU_Gen.idl index a4b58de1..0138653a 100644 --- a/idl/VISU_Gen.idl +++ b/idl/VISU_Gen.idl @@ -1852,6 +1852,22 @@ module VISU { /*! Shrinks and enlarges the 2D plot to fit the 2D viewer. */ void FitAll(); + + /*! Set range of the 2D plot to X axis of the 2D viewer. + */ + void FitXRange(in double xMin, in double xMax); + + /*! Set range of the 2D plot to Y axis of the 2D viewer. + */ + void FitYRange(in double yMin, in double yMax); + + /*! Set range of the 2D plot to XY axis of the 2D viewer. + */ + void FitRange(in double xMin, in double xMax, + in double yMin, in double yMax); + + void GetFitRanges(out double xMin,out double xMax, + out double yMin,out double yMax); }; //------------------------------------------------------- diff --git a/src/VISU_I/VISU_View_i.cc b/src/VISU_I/VISU_View_i.cc index 6b1244b5..b927adb1 100644 --- a/src/VISU_I/VISU_View_i.cc +++ b/src/VISU_I/VISU_View_i.cc @@ -1261,6 +1261,59 @@ namespace VISU { ProcessVoidEvent(new TVoidMemFunEvent (myView,&Plot2d_ViewFrame::fitAll)); } + class TFitRangeEvent: public SALOME_Event + { + public: + TFitRangeEvent (Plot2d_ViewFrame* theView, + const int mode, + const double xMin, const double xMax, + const double yMin, const double yMax): + myView(theView), + myMode(mode), + myXMin(xMin),myXMax(xMax), + myYMin(yMin),myYMax(yMax) + {} + virtual void Execute() + { + myView->fitData(myMode,myXMin,myXMax,myYMin,myYMax); + } + protected: + const int myMode; + const double myXMin; + const double myXMax; + const double myYMin; + const double myYMax; + Plot2d_ViewFrame* myView; + }; + + void XYPlot_i::FitXRange(const CORBA::Double xMin,const CORBA::Double xMax) + { + const CORBA::Long mode = 1; + const CORBA::Double yMin = 0.0; + const CORBA::Double yMax = 0.0; + ProcessVoidEvent(new TFitRangeEvent(myView,mode,xMin,xMax,yMin,yMax)); + } + + void XYPlot_i::FitYRange(const CORBA::Double yMin,const CORBA::Double yMax) + { + const CORBA::Long mode = 2; + const CORBA::Double xMin = 0.0; + const CORBA::Double xMax = 0.0; + ProcessVoidEvent(new TFitRangeEvent(myView,mode,xMin,xMax,yMin,yMax)); + } + + void XYPlot_i::FitRange(const CORBA::Double xMin,const CORBA::Double xMax, + const CORBA::Double yMin,const CORBA::Double yMax) + { + const CORBA::Long mode = 0; + ProcessVoidEvent(new TFitRangeEvent(myView,mode,xMin,xMax,yMin,yMax)); + } + + void XYPlot_i::GetFitRanges(double& xMin, double& xMax, double& yMin, double& yMax) + { + double y2Min,y2Max; + myView->getFitRanges(xMin,xMax,yMin,yMax,y2Min,y2Max); + } //=========================================================================== TableView_i::TableView_i (SalomeApp_Application* theApplication) diff --git a/src/VISU_I/VISU_View_i.hh b/src/VISU_I/VISU_View_i.hh index ae1f245b..4f9c8176 100644 --- a/src/VISU_I/VISU_View_i.hh +++ b/src/VISU_I/VISU_View_i.hh @@ -167,6 +167,11 @@ namespace VISU virtual void Update(); virtual void FitAll(); + virtual void FitXRange(const CORBA::Double xMin,const CORBA::Double xMax); + virtual void FitYRange(const CORBA::Double yMin,const CORBA::Double yMax); + virtual void FitRange(const CORBA::Double xMin,const CORBA::Double xMax, + const CORBA::Double yMin,const CORBA::Double yMax); + virtual void GetFitRanges(double& xMin, double& xMax, double& yMin, double& yMax); virtual void Close(); protected: -- 2.39.2