From: vsr Date: Tue, 29 Jul 2008 15:20:59 +0000 (+0000) Subject: merge from V4_1_0_maintainance branch (from tag mergeto_BR_QT4_Dev_29Jul08) X-Git-Tag: mergefrom_V4_1_0_maintainance_29Jul08 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ea4c9ef2739ac31dc1c1a96498a3ac1fd5583fde;p=modules%2Fvisu.git merge from V4_1_0_maintainance branch (from tag mergeto_BR_QT4_Dev_29Jul08) --- diff --git a/src/CONVERTOR/VISU_MedConvertor.cxx b/src/CONVERTOR/VISU_MedConvertor.cxx index e86e2e16..153f76f1 100644 --- a/src/CONVERTOR/VISU_MedConvertor.cxx +++ b/src/CONVERTOR/VISU_MedConvertor.cxx @@ -1553,6 +1553,7 @@ void BuildTimeStampMinMax(MED::SharedPtr theTimeStampValue, const MED::TGeom2Gauss& theGeom2Gauss, VISU::TMinMaxArr& theMinMaxArr, + VISU::TMinMaxArr& theAverageMinMaxArr, TInt theNbComp, TInt theNbComp2) { @@ -1574,7 +1575,8 @@ BuildTimeStampMinMax(MED::SharedPtr theTimeStampValue, "; aNbElem = "<(CastToFloatTimeStampValue(aTimeStampValue), aGeom2Gauss, aMinMaxArr, + anAverageMinMaxArr, aNbComp, aNbComp2); else BuildTimeStampMinMax(CastToIntTimeStampValue(aTimeStampValue), aGeom2Gauss, aMinMaxArr, + anAverageMinMaxArr, aNbComp, aNbComp2); diff --git a/src/CONVERTOR/VISU_Structures.cxx b/src/CONVERTOR/VISU_Structures.cxx index 35e2791f..8a17d7e1 100644 --- a/src/CONVERTOR/VISU_Structures.cxx +++ b/src/CONVERTOR/VISU_Structures.cxx @@ -78,7 +78,8 @@ namespace VISU ::TField(): myNbComp(0), myEntity(TEntity(-1)), - myIsMinMaxInitilized(false) + myIsMinMaxInitilized(false), + myIsELNO( false ) {} diff --git a/src/CONVERTOR/VISU_Structures.hxx b/src/CONVERTOR/VISU_Structures.hxx index 31f3e626..dec5f84f 100644 --- a/src/CONVERTOR/VISU_Structures.hxx +++ b/src/CONVERTOR/VISU_Structures.hxx @@ -219,6 +219,7 @@ namespace VISU TNames myCompNames; //!< Contains names of components of the MED FIELD TNames myUnitNames; //!< Contains names of units of the MED FIELD vtkIdType myNbComp; //!< Keeps number of components for the MED FIELD + bool myIsELNO; //!< Defines whether this field contains specific "ELNO" data or not //! Calculate min/max values for each of the MED FIELD components among all its timestamps /*! @@ -229,6 +230,11 @@ namespace VISU TMinMax GetMinMax(vtkIdType theCompID) = 0; + //! Calculate average min/max values for each of the MED FIELD components among all its timestamps + virtual + TMinMax + GetAverageMinMax(vtkIdType theCompID) = 0; + bool myIsMinMaxInitilized; //!< Is the min / max values are calculated TField(); diff --git a/src/CONVERTOR/VISU_Structures_impl.cxx b/src/CONVERTOR/VISU_Structures_impl.cxx index 1b69db66..6ed0a63d 100644 --- a/src/CONVERTOR/VISU_Structures_impl.cxx +++ b/src/CONVERTOR/VISU_Structures_impl.cxx @@ -1359,7 +1359,6 @@ namespace VISU ::TFieldImpl() : myDataSize( 0 ) , myDataType( 0 ) - , myIsELNO( false ) {} void @@ -1372,10 +1371,14 @@ namespace VISU myCompNames.resize(theNbComp); myUnitNames.resize(theNbComp); myMinMaxArr.resize(theNbComp + 1); + myAverageMinMaxArr.resize(theNbComp + 1); for(vtkIdType iComp = 0; iComp <= theNbComp; iComp++){ TMinMax& aMinMax = myMinMaxArr[iComp]; aMinMax.first = VTK_LARGE_FLOAT; aMinMax.second = -VTK_LARGE_FLOAT; + TMinMax& anAverageMinMax = myAverageMinMaxArr[iComp]; + anAverageMinMax.first = VTK_LARGE_FLOAT; + anAverageMinMax.second = -VTK_LARGE_FLOAT; } } @@ -1394,6 +1397,13 @@ namespace VISU } + TMinMax + TFieldImpl + ::GetAverageMinMax(vtkIdType theCompID) + { + return myAverageMinMaxArr[theCompID]; + } + //---------------------------------------------------------------------------- const PMeshValue& TGeom2Value diff --git a/src/CONVERTOR/VISU_Structures_impl.hxx b/src/CONVERTOR/VISU_Structures_impl.hxx index 8819f492..9cd67758 100644 --- a/src/CONVERTOR/VISU_Structures_impl.hxx +++ b/src/CONVERTOR/VISU_Structures_impl.hxx @@ -828,10 +828,16 @@ namespace VISU TMinMax GetMinMax(vtkIdType theCompID); + //! Implement the TField::GetAverageMinMax + virtual + TMinMax + GetAverageMinMax(vtkIdType theCompID); + vtkIdType myDataSize; //!< Keeps size of the assigned data vtkIdType myDataType; //!< Keeps type idetificator of the mesh data TMinMaxArr myMinMaxArr; //!< Keeps min/max values for each component of the MED FIELD - bool myIsELNO; //!< Defines whether this field contains specific "ELNO" data or not + TMinMaxArr myAverageMinMaxArr; //!< Keeps average by Gauss Points min/max values for each component of the MED FIELD + //!< If Nb of Gauss Points <=1 myAverageMinMaxArr equal myMinMaxArr }; diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.cc b/src/VISU_I/VISU_ColoredPrs3d_i.cc index 787eba58..1f153a75 100644 --- a/src/VISU_I/VISU_ColoredPrs3d_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3d_i.cc @@ -86,8 +86,10 @@ namespace VISU { if(!theResult->IsMinMaxDone()) theResult->GetInput()->BuildMinMax(); - - return theField->GetMinMax(theCompID); + if(theField->myIsELNO) + return theField->GetMinMax(theCompID); + else + return theField->GetAverageMinMax(theCompID); } //--------------------------------------------------------------- @@ -837,82 +839,6 @@ VISU::ColoredPrs3d_i } -//---------------------------------------------------------------------------- -struct TGetComponentMin: public SALOME_Event -{ - VISU::ColoredPrs3d_i* myColoredPrs3d; - vtkIdType myCompID; - - typedef CORBA::Double TResult; - TResult myResult; - - TGetComponentMin( VISU::ColoredPrs3d_i* theColoredPrs3d, - vtkIdType theCompID ): - myColoredPrs3d( theColoredPrs3d ), - myCompID( theCompID ) - {} - - virtual - void - Execute() - { - VISU::PMinMaxController aMinMaxController = myColoredPrs3d->GetMinMaxController(); - if ( aMinMaxController ) { - myResult = aMinMaxController->GetComponentMin( myCompID ); - } else { - VISU::TMinMax aTMinMax = myColoredPrs3d->GetScalarField()->GetMinMax( myCompID ); - myResult = aTMinMax.first; - } - } -}; - - -//---------------------------------------------------------------------------- -vtkFloatingPointType -VISU::ColoredPrs3d_i -::GetComponentMin(vtkIdType theCompID) -{ - return ProcessEvent( new TGetComponentMin( this, theCompID ) ); -} - -//---------------------------------------------------------------------------- -struct TGetComponentMax: public SALOME_Event -{ - VISU::ColoredPrs3d_i* myColoredPrs3d; - vtkIdType myCompID; - - typedef CORBA::Double TResult; - TResult myResult; - - TGetComponentMax( VISU::ColoredPrs3d_i* theColoredPrs3d, - vtkIdType theCompID ): - myColoredPrs3d( theColoredPrs3d ), - myCompID( theCompID ) - {} - - virtual - void - Execute() - { - VISU::PMinMaxController aMinMaxController = myColoredPrs3d->GetMinMaxController(); - if ( aMinMaxController ) { - myResult = aMinMaxController->GetComponentMax( myCompID ); - } else { - VISU::TMinMax aTMinMax = myColoredPrs3d->GetScalarField()->GetMinMax( myCompID ); - myResult = aTMinMax.second; - } - } -}; - - -//---------------------------------------------------------------------------- -vtkFloatingPointType -VISU::ColoredPrs3d_i -::GetComponentMax(vtkIdType theCompID) -{ - return ProcessEvent( new TGetComponentMax( this, theCompID ) ); -} - //---------------------------------------------------------------------------- void VISU::ColoredPrs3d_i diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.hh b/src/VISU_I/VISU_ColoredPrs3d_i.hh index 9046637c..c2035a21 100644 --- a/src/VISU_I/VISU_ColoredPrs3d_i.hh +++ b/src/VISU_I/VISU_ColoredPrs3d_i.hh @@ -228,11 +228,11 @@ namespace VISU virtual vtkFloatingPointType - GetComponentMin(vtkIdType theCompID); + GetComponentMin(vtkIdType theCompID) = 0; virtual vtkFloatingPointType - GetComponentMax(vtkIdType theCompID); + GetComponentMax(vtkIdType theCompID) = 0; virtual CORBA::Double diff --git a/src/VISU_I/VISU_GaussPoints_i.cc b/src/VISU_I/VISU_GaussPoints_i.cc index cbb1fe7f..2fa93815 100644 --- a/src/VISU_I/VISU_GaussPoints_i.cc +++ b/src/VISU_I/VISU_GaussPoints_i.cc @@ -1216,3 +1216,79 @@ VISU::GaussPoints_i { return mySpacing; } + +//---------------------------------------------------------------------------- +struct TGetComponentMin: public SALOME_Event +{ + VISU::ColoredPrs3d_i* myColoredPrs3d; + vtkIdType myCompID; + + typedef CORBA::Double TResult; + TResult myResult; + + TGetComponentMin( VISU::ColoredPrs3d_i* theColoredPrs3d, + vtkIdType theCompID ): + myColoredPrs3d( theColoredPrs3d ), + myCompID( theCompID ) + {} + + virtual + void + Execute() + { + VISU::PMinMaxController aMinMaxController = myColoredPrs3d->GetMinMaxController(); + if ( aMinMaxController ) { + myResult = aMinMaxController->GetComponentMin( myCompID ); + } else { + VISU::TMinMax aTMinMax = myColoredPrs3d->GetScalarField()->GetMinMax( myCompID ); + myResult = aTMinMax.first; + } + } +}; + + +//---------------------------------------------------------------------------- +vtkFloatingPointType +VISU::GaussPoints_i +::GetComponentMin(vtkIdType theCompID) +{ + return ProcessEvent( new TGetComponentMin( this, theCompID ) ); +} + +//---------------------------------------------------------------------------- +struct TGetComponentMax: public SALOME_Event +{ + VISU::ColoredPrs3d_i* myColoredPrs3d; + vtkIdType myCompID; + + typedef CORBA::Double TResult; + TResult myResult; + + TGetComponentMax( VISU::ColoredPrs3d_i* theColoredPrs3d, + vtkIdType theCompID ): + myColoredPrs3d( theColoredPrs3d ), + myCompID( theCompID ) + {} + + virtual + void + Execute() + { + VISU::PMinMaxController aMinMaxController = myColoredPrs3d->GetMinMaxController(); + if ( aMinMaxController ) { + myResult = aMinMaxController->GetComponentMax( myCompID ); + } else { + VISU::TMinMax aTMinMax = myColoredPrs3d->GetScalarField()->GetMinMax( myCompID ); + myResult = aTMinMax.second; + } + } +}; + + +//---------------------------------------------------------------------------- +vtkFloatingPointType +VISU::GaussPoints_i +::GetComponentMax(vtkIdType theCompID) +{ + return ProcessEvent( new TGetComponentMax( this, theCompID ) ); +} diff --git a/src/VISU_I/VISU_GaussPoints_i.hh b/src/VISU_I/VISU_GaussPoints_i.hh index 88e772ea..3a2109e0 100644 --- a/src/VISU_I/VISU_GaussPoints_i.hh +++ b/src/VISU_I/VISU_GaussPoints_i.hh @@ -287,6 +287,14 @@ namespace VISU virtual void RemoveAllGeom(); + + virtual + vtkFloatingPointType + GetComponentMin(vtkIdType theCompID); + + virtual + vtkFloatingPointType + GetComponentMax(vtkIdType theCompID); protected: //! Redefines VISU_ColoredPrs3d_i::DoSetInput diff --git a/src/VISU_I/VISU_ScalarMap_i.cc b/src/VISU_I/VISU_ScalarMap_i.cc index 61edb836..f0aba10a 100644 --- a/src/VISU_I/VISU_ScalarMap_i.cc +++ b/src/VISU_I/VISU_ScalarMap_i.cc @@ -464,3 +464,87 @@ VISU::ScalarMap_i } TSuperClass::UpdateActor(theActor); } + +//---------------------------------------------------------------------------- +struct TGetComponentMin: public SALOME_Event +{ + VISU::ColoredPrs3d_i* myColoredPrs3d; + vtkIdType myCompID; + + typedef CORBA::Double TResult; + TResult myResult; + + TGetComponentMin( VISU::ColoredPrs3d_i* theColoredPrs3d, + vtkIdType theCompID ): + myColoredPrs3d( theColoredPrs3d ), + myCompID( theCompID ) + {} + + virtual + void + Execute() + { + VISU::PMinMaxController aMinMaxController = myColoredPrs3d->GetMinMaxController(); + if ( aMinMaxController ) { + myResult = aMinMaxController->GetComponentMin( myCompID ); + } else { + VISU::TMinMax aTMinMax; + if(myColoredPrs3d->GetScalarField()->myIsELNO) + aTMinMax = myColoredPrs3d->GetScalarField()->GetMinMax( myCompID ); + else + aTMinMax = myColoredPrs3d->GetScalarField()->GetAverageMinMax( myCompID ); + myResult = aTMinMax.first; + } + } +}; + + +//---------------------------------------------------------------------------- +vtkFloatingPointType +VISU::ScalarMap_i +::GetComponentMin(vtkIdType theCompID) +{ + return ProcessEvent( new TGetComponentMin( this, theCompID ) ); +} + +//---------------------------------------------------------------------------- +struct TGetComponentMax: public SALOME_Event +{ + VISU::ColoredPrs3d_i* myColoredPrs3d; + vtkIdType myCompID; + + typedef CORBA::Double TResult; + TResult myResult; + + TGetComponentMax( VISU::ColoredPrs3d_i* theColoredPrs3d, + vtkIdType theCompID ): + myColoredPrs3d( theColoredPrs3d ), + myCompID( theCompID ) + {} + + virtual + void + Execute() + { + VISU::PMinMaxController aMinMaxController = myColoredPrs3d->GetMinMaxController(); + if ( aMinMaxController ) { + myResult = aMinMaxController->GetComponentMax( myCompID ); + } else { + VISU::TMinMax aTMinMax; + if(myColoredPrs3d->GetScalarField()->myIsELNO) + aTMinMax = myColoredPrs3d->GetScalarField()->GetMinMax( myCompID ); + else + aTMinMax = myColoredPrs3d->GetScalarField()->GetAverageMinMax( myCompID ); + myResult = aTMinMax.second; + } + } +}; + + +//---------------------------------------------------------------------------- +vtkFloatingPointType +VISU::ScalarMap_i +::GetComponentMax(vtkIdType theCompID) +{ + return ProcessEvent( new TGetComponentMax( this, theCompID ) ); +} diff --git a/src/VISU_I/VISU_ScalarMap_i.hh b/src/VISU_I/VISU_ScalarMap_i.hh index e83d332b..44a7ba96 100644 --- a/src/VISU_I/VISU_ScalarMap_i.hh +++ b/src/VISU_I/VISU_ScalarMap_i.hh @@ -183,6 +183,14 @@ namespace VISU void UpdateActor(VISU_ActorBase* theActor); + virtual + vtkFloatingPointType + GetComponentMin(vtkIdType theCompID); + + virtual + vtkFloatingPointType + GetComponentMax(vtkIdType theCompID); + private: VISU_ScalarMapPL* myScalarMapPL; };