From 34c3097f004b20450286650094b1cb5040cc4e3d Mon Sep 17 00:00:00 2001 From: apo Date: Fri, 3 Nov 2006 06:49:43 +0000 Subject: [PATCH] To extend and clarify VISU IDL definition. 1. Three new functions are added to the ColoredPrs3d interface, namely /*! * Gets the min boundary of the scalar bar from source data. */ double GetSourceMin(); /*! * Gets the max boundary of the scalar bar from source data. */ double GetSourceMax(); /*! * Defines whether the scalar range corresponds to the source data or not. */ boolean IsRangeFixed(); 2. A new function is introduced in the ScalarMap interface, namely /*! * Sets scalar range that corresponds to the source data. */ void SetSourceRange(); 3. Three functions are removed from ScalarMapOnDeformedShape, because they have the same meaning as in ScalaraMap (a basic interface for it), namely /*! * Sets the source ranges of pipeline */ void SetSourceRange(in double theMinRange,in double theMaxRange); /*! * Gets the minimum source range of pipeline */ double GetSourceRangeMin(); /*! * Gets the maximum source range of pipeline */ double GetSourceRangeMax(); --- idl/VISU_Gen.idl | 33 +++++++---- src/VISUGUI/VisuGUI_ScalarBarDlg.cxx | 6 +- src/VISU_I/VISU_ColoredPrs3d_i.cc | 59 ++++++++++++++++++- src/VISU_I/VISU_ColoredPrs3d_i.hh | 26 ++++++-- src/VISU_I/VISU_DumpPython.cc | 2 +- src/VISU_I/VISU_GaussPoints_i.cc | 9 +-- src/VISU_I/VISU_GaussPoints_i.hh | 2 +- src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc | 34 ----------- src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh | 13 ---- src/VISU_I/VISU_ScalarMap_i.cc | 30 ++++------ src/VISU_I/VISU_ScalarMap_i.hh | 11 ++-- 11 files changed, 125 insertions(+), 100 deletions(-) diff --git a/idl/VISU_Gen.idl b/idl/VISU_Gen.idl index ddb2b9cd..7a659d09 100644 --- a/idl/VISU_Gen.idl +++ b/idl/VISU_Gen.idl @@ -474,6 +474,21 @@ module VISU { */ double GetMax(); + /*! + * Gets the min boundary of the scalar bar from source data. + */ + double GetSourceMin(); + + /*! + * Gets the max boundary of the scalar bar from source data. + */ + double GetSourceMax(); + + /*! + * Defines whether the scalar range corresponds to the source data or not. + */ + boolean IsRangeFixed(); + /*! \brief Position of the scalar bar. * * Sets the position of the scalar bar origin on the screen. @@ -580,6 +595,11 @@ module VISU { */ void SetRange(in double theMin, in double theMax); + /*! + * Sets scalar range that corresponds to the source data. + */ + void SetSourceRange(); + /*! %Orientation of the scalar bar (to provide backward compatibility). */ enum Orientation { HORIZONTAL, /*!< Horizontal orientation of the scalar bar.*/ @@ -653,19 +673,6 @@ module VISU { */ interface ScalarMapOnDeformedShape : ScalarMap { - /*! - * Sets the source ranges of pipeline - */ - void SetSourceRange(in double theMinRange,in double theMaxRange); - /*! - * Gets the minimum source range of pipeline - */ - double GetSourceRangeMin(); - /*! - * Gets the maximum source range of pipeline - */ - double GetSourceRangeMax(); - /*! * Sets the scale of the presentatable object. * \param theScale Double value defining the scale of this presentable object. diff --git a/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx b/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx index d0960c6b..47fa0a69 100644 --- a/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx +++ b/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx @@ -562,8 +562,7 @@ void VisuGUI_ScalarBarPane::initFromPrsObject(VISU::ScalarMap_i* thePrs) { default: setLogarithmic(false); } - vtkFloatingPointType aRange[2]; - thePrs->GetSpecificPL()->GetSourceRange(aRange); + CORBA::Double aRange[2] = {thePrs->GetSourceMin(), thePrs->GetSourceMax()}; Rmin = aRange[0]; Rmax = aRange[1]; setRange( thePrs->GetMin(), thePrs->GetMax(), /*0.0, 0.0,*/ thePrs->IsRangeFixed() ); @@ -913,10 +912,9 @@ void VisuGUI_ScalarBarPane::changeScalarMode( int theMode ) { if ( myScalarMap ) { if ( RBFrange->isChecked() ) { - vtkFloatingPointType aRange[2]; int aMode = myScalarMap->GetScalarMode(); myScalarMap->SetScalarMode(theMode); - myScalarMap->GetSpecificPL()->GetSourceRange(aRange); + CORBA::Double aRange[2] = {myScalarMap->GetSourceMin(), myScalarMap->GetSourceMax()}; MinEdit->setText( QString::number( aRange[0] ) ); MaxEdit->setText( QString::number( aRange[1] ) ); myScalarMap->SetScalarMode(aMode); diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.cc b/src/VISU_I/VISU_ColoredPrs3d_i.cc index 5059f347..93e16afd 100644 --- a/src/VISU_I/VISU_ColoredPrs3d_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3d_i.cc @@ -128,7 +128,7 @@ VISU::ColoredPrs3d_i if(anIsNotCreated) CreatePipeLine(NULL); // to create proper pipeline - DoSetInput(); + DoSetInput(anIsNotCreated); SetTitle(GetCTitle().c_str()); return anIsNotCreated; @@ -397,6 +397,59 @@ VISU::ColoredPrs3d_i return myScalarMapPL->GetScalarRange()[1]; } +//---------------------------------------------------------------------------- +void +VISU::ColoredPrs3d_i +::SetRange(CORBA::Double theMin, CORBA::Double theMax) +{ + if(theMin > theMax) + return; + vtkFloatingPointType aScalarRange[2] = {theMin, theMax}; + GetSpecificPL()->SetScalarRange(aScalarRange); + UseFixedRange(true); +} + + +//---------------------------------------------------------------------------- +void +VISU::ColoredPrs3d_i +::SetSourceRange() +{ + if(IsTimeStampFixed()) + GetSpecificPL()->SetSourceRange(); + else{ + TMinMax aTMinMax = GetField()->GetMinMax(GetScalarMode()); + vtkFloatingPointType aScalarRange[2] = {aTMinMax.first, aTMinMax.second}; + GetSpecificPL()->SetScalarRange(aScalarRange); + } + UseFixedRange(false); +} + +CORBA::Double +VISU::ColoredPrs3d_i +::GetSourceMin() +{ + if(IsTimeStampFixed()) + return myScalarMapPL->GetScalarRange()[0]; + else{ + TMinMax aTMinMax = GetField()->GetMinMax(GetScalarMode()); + return aTMinMax.first; + } +} + +CORBA::Double +VISU::ColoredPrs3d_i +::GetSourceMax() +{ + if(IsTimeStampFixed()) + return myScalarMapPL->GetScalarRange()[1]; + else{ + TMinMax aTMinMax = GetField()->GetMinMax(GetScalarMode()); + return aTMinMax.second; + } +} + +//---------------------------------------------------------------------------- void VISU::ColoredPrs3d_i ::SetNbColors(CORBA::Long theNbColors) @@ -704,7 +757,7 @@ VISU::ColoredPrs3d_i //---------------------------------------------------------------------------- -bool +CORBA::Boolean VISU::ColoredPrs3d_i ::IsRangeFixed() { @@ -984,7 +1037,7 @@ VISU::ColoredPrs3d_i myName = "NoName"; if(theBuildMode == ECreateNew || theBuildMode == ESameAs){ if(!myIsFixedRange) - myScalarMapPL->SetSourceRange(); + SetSourceRange(); if(theBuildMode == ECreateNew) SetTitle(GetCFieldName().c_str()); } diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.hh b/src/VISU_I/VISU_ColoredPrs3d_i.hh index 2c6ba689..427d88ae 100644 --- a/src/VISU_I/VISU_ColoredPrs3d_i.hh +++ b/src/VISU_I/VISU_ColoredPrs3d_i.hh @@ -126,6 +126,26 @@ namespace VISU CORBA::Double GetMax(); + virtual + void + SetRange(CORBA::Double theMin, CORBA::Double theMax); + + virtual + CORBA::Double + GetSourceMin(); + + virtual + CORBA::Double + GetSourceMax(); + + virtual + void + SetSourceRange(); + + virtual + CORBA::Boolean + IsRangeFixed(); + virtual void SetNbColors(CORBA::Long theNbColors); @@ -314,10 +334,6 @@ namespace VISU vtkFloatingPointType theG, vtkFloatingPointType theB); - virtual - bool - IsRangeFixed(); - VISU_ScalarMapPL* GetSpecificPL() const { @@ -365,7 +381,7 @@ namespace VISU */ virtual void - DoSetInput() = 0; + DoSetInput(bool theIsInitilizePipe) = 0; /*! The enumeration allow to define what mode should be used for the presentation building. diff --git a/src/VISU_I/VISU_DumpPython.cc b/src/VISU_I/VISU_DumpPython.cc index 1c4337f6..fe78c72a 100644 --- a/src/VISU_I/VISU_DumpPython.cc +++ b/src/VISU_I/VISU_DumpPython.cc @@ -773,7 +773,7 @@ namespace VISU if(ScalarMapOnDeformedShape_i* aServant = dynamic_cast(GetServant(anObj).in())){ thePrefix = ScalarMapToPython(theSObject,aServant,theStr,aName,"ScalarMapOnDeformedShapeOnField",theArgumentName,thePrefix); - theStr<GetSourceRangeMin()<<","<GetSourceRangeMax()<<")"<GetMin()<<","<GetMax()<<")"<GetScale()<<")"<GetInput(); if(!anInput) @@ -521,9 +521,10 @@ VISU::GaussPoints_i throw std::runtime_error("There is no TimeStamp with the parameters !!!"); GetSpecificPL()->SetGaussPtsIDMapper(aGaussPtsIDMapper); - GetSpecificPL()->Init(); - GetSpecificPL()->Build(); - + if(theIsInitilizePipe){ + GetSpecificPL()->Init(); + GetSpecificPL()->Build(); + } GetCResult()->MinMaxConnect(this); } diff --git a/src/VISU_I/VISU_GaussPoints_i.hh b/src/VISU_I/VISU_GaussPoints_i.hh index e14bf9c5..57162216 100644 --- a/src/VISU_I/VISU_GaussPoints_i.hh +++ b/src/VISU_I/VISU_GaussPoints_i.hh @@ -252,7 +252,7 @@ namespace VISU //! Redefines VISU_ColoredPrs3d_i::DoSetInput virtual void - DoSetInput(); + DoSetInput(bool theIsInitilizePipe); //! Redefines VISU_ColoredPrs3d_i::CreatePipeLine virtual diff --git a/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc index 8d6a77c6..bd1c1f84 100644 --- a/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc +++ b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc @@ -289,40 +289,6 @@ VISU::ScalarMapOnDeformedShape_i } -//--------------------------------------------------------------- -void -VISU::ScalarMapOnDeformedShape_i -::SetSourceRange(CORBA::Double theMinRange,CORBA::Double theMaxRange) -{ - vtkFloatingPointType aRange[2]; - aRange[0] = vtkFloatingPointType(theMinRange); - aRange[1] = vtkFloatingPointType(theMaxRange); - myScalarMapOnDeformedShapePL->SetScalarRange(aRange); -} - - -//--------------------------------------------------------------- -CORBA::Double -VISU::ScalarMapOnDeformedShape_i -::GetSourceRangeMin() -{ - vtkFloatingPointType aRange[2]; - myScalarMapOnDeformedShapePL->GetSourceRange(aRange); - return aRange[0]; -} - - -//--------------------------------------------------------------- -CORBA::Double -VISU::ScalarMapOnDeformedShape_i -::GetSourceRangeMax() -{ - vtkFloatingPointType aRange[2]; - myScalarMapOnDeformedShapePL->GetSourceRange(aRange); - return aRange[1]; -} - - //--------------------------------------------------------------- void VISU::ScalarMapOnDeformedShape_i diff --git a/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh index bf62f461..2d694336 100644 --- a/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh +++ b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh @@ -84,19 +84,6 @@ namespace VISU void SetColor(const SALOMEDS::Color& theColor); - virtual - void - SetSourceRange(CORBA::Double theMinRange, - CORBA::Double theMaxRange); - - virtual - CORBA::Double - GetSourceRangeMin(); - - virtual - CORBA::Double - GetSourceRangeMax(); - virtual void SameAs(const Prs3d_i* theOrigin); diff --git a/src/VISU_I/VISU_ScalarMap_i.cc b/src/VISU_I/VISU_ScalarMap_i.cc index 5d7c37f8..fa2f3e99 100644 --- a/src/VISU_I/VISU_ScalarMap_i.cc +++ b/src/VISU_I/VISU_ScalarMap_i.cc @@ -250,18 +250,21 @@ void VISU::ScalarMap_i ::SetRange(CORBA::Double theMin, CORBA::Double theMax) { - if(theMin > theMax) - return; - vtkFloatingPointType aScalarRange[2] = {theMin, theMax}; - GetSpecificPL()->SetScalarRange(aScalarRange); - UseFixedRange(true); + TSuperClass::SetRange(theMin, theMax); } +//---------------------------------------------------------------------------- +void +VISU::ScalarMap_i +::SetSourceRange() +{ + TSuperClass::SetSourceRange(); +} //---------------------------------------------------------------------------- void VISU::ScalarMap_i -::DoSetInput() +::DoSetInput(bool theIsInitilizePipe) { VISU::Result_i::TInput* anInput = GetCResult()->GetInput(); if(!anInput) @@ -278,8 +281,10 @@ VISU::ScalarMap_i throw std::runtime_error("There is no TimeStamp with the parameters !!!"); GetSpecificPL()->SetIDMapper(anIDMapper); - GetSpecificPL()->Init(); - GetSpecificPL()->Build(); + if(theIsInitilizePipe){ + GetSpecificPL()->Init(); + GetSpecificPL()->Build(); + } } @@ -300,15 +305,6 @@ VISU::ScalarMap_i GetSpecificPL()->SetMapScale(theMapScale); } -//---------------------------------------------------------------------------- -void -VISU::ScalarMap_i -::SetSourceRange() -{ - GetSpecificPL()->SetSourceRange(); - UseFixedRange(false); -} - //---------------------------------------------------------------------------- VISU_Actor* VISU::ScalarMap_i diff --git a/src/VISU_I/VISU_ScalarMap_i.hh b/src/VISU_I/VISU_ScalarMap_i.hh index 34f2266a..9ee01ff2 100644 --- a/src/VISU_I/VISU_ScalarMap_i.hh +++ b/src/VISU_I/VISU_ScalarMap_i.hh @@ -72,6 +72,11 @@ namespace VISU void SetRange(CORBA::Double theMin, CORBA::Double theMax); + virtual + void + SetSourceRange(); + + // To provide backward compatibility virtual void @@ -87,7 +92,7 @@ namespace VISU //! Redefines VISU_ColoredPrs3d_i::DoSetInput virtual void - DoSetInput(); + DoSetInput(bool theIsInitilizePipe); //! Redefines VISU_ColoredPrs3d_i::CheckIsPossible virtual @@ -144,10 +149,6 @@ namespace VISU void SetMapScale(double theMapScale = 1.0); - virtual - void - SetSourceRange(); - virtual void SameAs(const Prs3d_i* theOrigin); -- 2.39.2