template<class TPrs3d, class TDialog>
void
InitDiloglgFromPrsObject(TDialog* theDialog,
- FieldData& theData)
+ TPrs3d* thePrs3d)
{
- theDialog->initFromPrsObject(dynamic_cast<TPrs3d*>(theData.myPrs[0]));
+ theDialog->initFromPrsObject(thePrs3d);
}
void
InitDiloglgFromPrsObject
<VISU::ScalarMapOnDeformedShape_i, VisuGUI_ScalarMapOnDeformedShapeDlg>(VisuGUI_ScalarMapOnDeformedShapeDlg* theDialog,
- FieldData& theData)
+ VISU::ScalarMapOnDeformedShape_i* thePrs3d)
{
- theDialog->initFromPrsObject(dynamic_cast<VISU::ScalarMapOnDeformedShape_i*>(theData.myPrs[0]), true);
+ theDialog->initFromPrsObject(thePrs3d, true);
}
VISU_TimeAnimation* theAnimator)
{
TDialog* aDlg = new TDialog(theModule);
- InitDiloglgFromPrsObject<TPrs3d, TDialog>(aDlg, theData);
+ TPrs3d* aPrs3d = dynamic_cast<TPrs3d*>(theData.myPrs[0]);
+ InitDiloglgFromPrsObject<TPrs3d, TDialog>(aDlg, aPrs3d);
if (aDlg->exec()) {
- aDlg->storeToPrsObject(dynamic_cast<TPrs3d*>(theData.myPrs[0]));
- for (int i = 1; i < theData.myNbFrames; i++)
- theData.myPrs[i]->SameAsParams(theData.myPrs[0],
- theData.myPrs[i]->GetMeshName(),
- theData.myPrs[i]->GetFieldName(),
- theData.myPrs[i]->GetEntity(),
- theData.myPrs[i]->GetIteration(),
- true);
- if ( theAnimator->getAnimationMode() == 1 ) {
- for (int i = 1; i < theAnimator->getNbFields(); i++) {
- for (int j = 0; j < theAnimator->getFieldData(i).myNbFrames; j++)
- theAnimator->getFieldData(i).myPrs[j]->SameAsParams(theData.myPrs[0],
- theData.myPrs[j]->GetMeshName(),
- theData.myPrs[j]->GetFieldName(),
- theData.myPrs[j]->GetEntity(),
- theData.myPrs[j]->GetIteration(),
- true);
+ aDlg->storeToPrsObject(dynamic_cast<TPrs3d*>(aPrs3d));
+ for (long aFrameId = 1; aFrameId < theData.myNbFrames; aFrameId++){
+ VISU::ColoredPrs3d_i* aColoredPrs3d = theData.myPrs[aFrameId];
+ aColoredPrs3d->SameAsParams(aPrs3d,
+ aColoredPrs3d->GetMeshName(),
+ aColoredPrs3d->GetFieldName(),
+ aColoredPrs3d->GetEntity(),
+ aColoredPrs3d->GetIteration(),
+ true);
+ }
+
+ if ( theAnimator->getAnimationMode() == VISU::Animation::SUCCCESSIVE ) {
+ for (int aFieldId = 1; aFieldId < theAnimator->getNbFields(); aFieldId++) {
+ FieldData& aFieldData = theAnimator->getFieldData(aFieldId);
+ for (long aFrameId = 0; aFrameId < aFieldData.myNbFrames; aFrameId++) {
+ VISU::ColoredPrs3d_i* aColoredPrs3d = aFieldData.myPrs[aFrameId];
+ CORBA::String_var aTitle = aColoredPrs3d->GetTitle();
+ aColoredPrs3d->SameAsParams(aPrs3d,
+ aColoredPrs3d->GetMeshName(),
+ aColoredPrs3d->GetFieldName(),
+ aColoredPrs3d->GetEntity(),
+ aColoredPrs3d->GetIteration(),
+ true);
+ aColoredPrs3d->SetTitle(aTitle);
+ }
}
}
}
VISU_CorbaMedConvertor.cxx \
VISU_DumpPython.cc \
VISU_ScalarMapOnDeformedShape_i.cc \
- VISU_PrsMerger_i.cc
+ VISU_PrsMerger_i.cc \
+ SALOME_GenericObjPointer.cc
LIB_MOC = \
VISU_TimeAnimation.h
VISU_View_i.hh \
VISU_TimeAnimation.h \
VISU_ScalarMapOnDeformedShape_i.hh \
- VISU_PrsMerger_i.hh
+ VISU_PrsMerger_i.hh \
+ SALOME_GenericObjPointer.hh
# additionnal information to compil and link file
CPPFLAGS += \
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+// File : SALOME_GenericObjPtr.cc
+// Author : Oleg UVAROV
+// Module : SALOME
+
+#include "SALOME_GenericObjPointer.hh"
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+// File : SALOME_GenericObjPtr.hh
+// Author : Oleg UVAROV
+// Module : SALOME
+
+#ifndef SALOME_GenericObjPointer_HH
+#define SALOME_GenericObjPointer_HH
+
+#include "SALOMEconfig.h"
+#include CORBA_SERVER_HEADER(SALOME_GenericObj)
+
+#include <iosfwd> // for std::basic_ostream
+
+namespace SALOME
+{
+ //----------------------------------------------------------------------------
+ template <class TGenericObj>
+ class GenericObjPtr
+ {
+ //! Pointer to the actual object.
+ TGenericObj* myPointer;
+
+ void
+ swap(GenericObjPtr& thePointer)
+ {
+ TGenericObj* aPointer = thePointer.myPointer;
+ thePointer.myPointer = this->myPointer;
+ this->myPointer = aPointer;
+ }
+
+ void
+ Register()
+ {
+ if(this->myPointer)
+ this->myPointer->Register();
+ }
+
+ void
+ Destroy()
+ {
+ if(this->myPointer){
+ this->myPointer->Destroy();
+ this->myPointer = NULL;
+ }
+ }
+
+ public:
+ //! Initialize smart pointer to NULL.
+ GenericObjPtr():
+ myPointer(NULL)
+ {}
+
+ //! Initialize smart pointer to given object (TSGenericObj must be complete).
+ template<class TGenObj>
+ explicit
+ GenericObjPtr(TGenObj* thePointer):
+ myPointer(thePointer)
+ {
+ this->Register();
+ }
+
+ /*!
+ Initialize smart pointer with a new reference to the same object
+ referenced by given smart pointer.
+ */
+ GenericObjPtr(const GenericObjPtr& thePointer):
+ myPointer(thePointer.myPointer)
+ {
+ this->Register();
+ }
+
+ /*!
+ Initialize smart pointer with a new reference to the same object
+ referenced by given smart pointer.
+ */
+ template<class TGenObj>
+ GenericObjPtr(const GenericObjPtr<TGenObj>& thePointer):
+ myPointer(thePointer.get())
+ {
+ this->Register();
+ }
+
+ //! Destroy smart pointer and remove the reference to its object.
+ ~GenericObjPtr()
+ {
+ this->Destroy();
+ }
+
+ /*!
+ Assign object to reference. This removes any reference to an old
+ object.
+ */
+ template<class TGenObj>
+ GenericObjPtr&
+ operator=(TGenObj* thePointer)
+ {
+ GenericObjPtr aTmp(thePointer);
+ aTmp.swap(*this);
+ return *this;
+ }
+
+ /*!
+ Assign object to reference. This removes any reference to an old
+ object.
+ */
+ GenericObjPtr&
+ operator=(const GenericObjPtr& thePointer)
+ {
+ GenericObjPtr aTmp(thePointer);
+ aTmp.swap(*this);
+ return *this;
+ }
+
+ /*!
+ Assign object to reference. This removes any reference to an old
+ object.
+ */
+ template<class TGenObj>
+ GenericObjPtr&
+ operator=(const GenericObjPtr<TGenObj>& thePointer)
+ {
+ GenericObjPtr aTmp(thePointer);
+ aTmp.swap(*this);
+ return *this;
+ }
+
+ //! Get the contained pointer.
+ virtual
+ TGenericObj*
+ get() const
+ {
+ return this->myPointer;
+ }
+
+ //! Get the contained pointer.
+ operator TGenericObj* () const
+ {
+ return this->get();
+ }
+
+ /*!
+ Dereference the pointer and return a reference to the contained
+ object.
+ */
+ TGenericObj&
+ operator*() const
+ {
+ return *this->get();
+ }
+
+ //! Provides normal pointer target member access using operator ->.
+ TGenericObj* operator->() const
+ {
+ return this->get();
+ }
+
+ operator bool () const
+ {
+ return this->get() != 0;
+ }
+ };
+}
+
+template<class T, class U>
+inline
+bool
+operator<(SALOME::GenericObjPtr<T> const & a, SALOME::GenericObjPtr<U> const & b)
+{
+ return a.get() < b.get();
+}
+
+template<class T, class U>
+inline
+bool
+operator==(SALOME::GenericObjPtr<T> const & a, SALOME::GenericObjPtr<U> const & b)
+{
+ return a.get() == b.get();
+}
+
+template<class T, class U>
+inline
+bool
+operator!=(SALOME::GenericObjPtr<T> const & a, SALOME::GenericObjPtr<U> const & b)
+{
+ return a.get() != b.get();
+}
+
+template<class Y>
+std::ostream&
+operator<< (std::ostream & os, SALOME::GenericObjPtr<Y> const & p)
+{
+ os << p.get();
+ return os;
+}
+
+
+#endif
#endif
+namespace VISU
+{
+ //---------------------------------------------------------------
+ vtkFloatingPointType
+ TMinMaxController
+ ::GetComponentMin(vtkIdType theCompID)
+ {
+ return VTK_LARGE_FLOAT;
+ }
+
+
+ //---------------------------------------------------------------
+ vtkFloatingPointType
+ TMinMaxController
+ ::GetComponentMax(vtkIdType theCompID)
+ {
+ return -VTK_LARGE_FLOAT;
+ }
+
+
+ //---------------------------------------------------------------
+ struct TSimpleMinMaxController: virtual TVTKMinMaxController
+ {
+ VISU::PField myField;
+
+ TSimpleMinMaxController(VISU::PField theField)
+ {
+ myField = theField;
+ }
+
+ virtual
+ vtkFloatingPointType
+ GetComponentMin(vtkIdType theCompID)
+ {
+ if(myField){
+ TMinMax aMinMax = myField->GetMinMax(theCompID);
+ return aMinMax.first;
+ }
+ return TMinMaxController::GetComponentMin(theCompID);
+ }
+
+ virtual
+ vtkFloatingPointType
+ GetComponentMax(vtkIdType theCompID)
+ {
+ if(myField){
+ TMinMax aMinMax = myField->GetMinMax(theCompID);
+ return aMinMax.second;
+ }
+ return TMinMaxController::GetComponentMax(theCompID);
+ }
+ };
+
+
+ //---------------------------------------------------------------
+ PMinMaxController
+ CreateDefaultMinMaxController(VISU::ColoredPrs3d_i* theColoredPrs3d)
+ {
+ PField aField = theColoredPrs3d->GetField();
+ return PMinMaxController(new TSimpleMinMaxController(aField));
+ }
+
+
+ //---------------------------------------------------------------
+}
+
//============================================================================
VISU::ColoredPrs3d_i::
ColoredPrs3d_i(Result_i* theResult,
myIsFixedRange(false)
{}
+//---------------------------------------------------------------
VISU::ColoredPrs3d_i
::~ColoredPrs3d_i()
{}
+//---------------------------------------------------------------
+void
+VISU::ColoredPrs3d_i
+::Register()
+{
+ TSuperClass::Register();
+}
+
+//---------------------------------------------------------------
+void
+VISU::ColoredPrs3d_i
+::Destroy()
+{
+ TSuperClass::Destroy();
+}
+
//---------------------------------------------------------------
void
VISU::ColoredPrs3d_i
SetNbColors(anOrigin->GetNbColors());
SetBarOrientation(anOrigin->GetBarOrientation());
+ SetMinMaxController(anOrigin->GetMinMaxController());
+
+ if(anOrigin->IsRangeFixed())
+ SetRange(anOrigin->GetMin(), anOrigin->GetMax());
+ else
+ SetSourceRange();
+
SetPosition(anOrigin->GetPosX(), anOrigin->GetPosY());
SetSize(anOrigin->GetWidth(), anOrigin->GetHeight());
SetLabels(anOrigin->GetLabels());
return myScalarMapPL->GetScalarRange()[1];
}
+//----------------------------------------------------------------------------
+void
+VISU::ColoredPrs3d_i
+::SetRange(CORBA::Double theMin, CORBA::Double theMax)
+{
+ vtkFloatingPointType aScalarRange[2] = {theMin, theMax};
+ ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_ScalarMapPL, vtkFloatingPointType*>
+ (GetScalarMapPL(), &VISU_ScalarMapPL::SetScalarRange, aScalarRange));
+
+ myIsFixedRange = true;
+}
+
+//----------------------------------------------------------------------------
+bool
+VISU::ColoredPrs3d_i
+::IsRangeFixed()
+{
+ return myIsFixedRange;
+}
+
+//----------------------------------------------------------------------------
+void
+VISU::ColoredPrs3d_i
+::SetSourceRange()
+{
+ if(IsTimeStampFixed()){
+ ProcessVoidEvent(new TVoidMemFunEvent<VISU_ScalarMapPL>
+ (myScalarMapPL, &VISU_ScalarMapPL::SetSourceRange));
+ }else{
+ vtkFloatingPointType aScalarRange[2] = {GetSourceMin(), GetSourceMax()};
+ ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_ScalarMapPL, vtkFloatingPointType*>
+ (myScalarMapPL, &VISU_ScalarMapPL::SetScalarRange, aScalarRange));
+ }
+
+ myIsFixedRange = false;
+}
+
+//----------------------------------------------------------------------------
+CORBA::Double
+VISU::ColoredPrs3d_i
+::GetSourceMin()
+{
+ if(IsTimeStampFixed()){
+ vtkFloatingPointType aRange[2];
+ GetScalarMapPL()->GetSourceRange(aRange);
+ return aRange[0];
+ }
+ return GetComponentMin(GetScalarMode());
+}
+
+//----------------------------------------------------------------------------
+CORBA::Double
+VISU::ColoredPrs3d_i
+::GetSourceMax()
+{
+ if(IsTimeStampFixed()){
+ vtkFloatingPointType aRange[2];
+ GetScalarMapPL()->GetSourceRange(aRange);
+ return aRange[1];
+ }
+ return GetComponentMax(GetScalarMode());
+}
+
+//----------------------------------------------------------------------------
+vtkFloatingPointType
+VISU::ColoredPrs3d_i
+::GetComponentMin(vtkIdType theCompID)
+{
+ if(PMinMaxController aMinMaxController = GetMinMaxController())
+ return aMinMaxController->GetComponentMin(theCompID);
+
+ TMinMax aTMinMax = GetField()->GetMinMax(theCompID);
+ return aTMinMax.first;
+}
+
+//----------------------------------------------------------------------------
+vtkFloatingPointType
+VISU::ColoredPrs3d_i
+::GetComponentMax(vtkIdType theCompID)
+{
+ if(PMinMaxController aMinMaxController = GetMinMaxController())
+ return aMinMaxController->GetComponentMax(theCompID);
+
+ TMinMax aTMinMax = GetField()->GetMinMax(theCompID);
+ return aTMinMax.second;
+}
+
+//----------------------------------------------------------------------------
void
VISU::ColoredPrs3d_i
::SetNbColors(CORBA::Long theNbColors)
QString aComment;
myName = "NoName";
if(theRestoring <= 0){
- if(theRestoring == 0) myScalarMapPL->Init();
- if(!myIsFixedRange) myScalarMapPL->SetSourceRange();
+ if(theRestoring == 0)
+ myScalarMapPL->Init();
+ if(!myIsFixedRange)
+ myScalarMapPL->SetSourceRange();
const VISU::TValField& aValField = myField->myValField;
const VISU::PValForTime aValForTime = aValField.find(myIteration)->second;
aComment.sprintf("%s %s",myFieldName.c_str(),VISU_Convertor::GenerateName(aValForTime->myTime).c_str());
return myField;
}
+
+//----------------------------------------------------------------------------
CORBA::Boolean
VISU::ColoredPrs3d_i
::IsTimeStampFixed()
return !CORBA::is_nil(aSObject);
}
+
+//----------------------------------------------------------------------------
+VISU::PMinMaxController
+VISU::ColoredPrs3d_i
+::GetMinMaxController()
+{
+ return myMinMaxController;
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU::ColoredPrs3d_i
+::SetMinMaxController(const VISU::PMinMaxController& theController)
+{
+ myMinMaxController = theController;
+
+ if(!IsRangeFixed())
+ SetSourceRange();
+}
+
+
+//----------------------------------------------------------------------------
const std::string&
VISU::ColoredPrs3d_i
::GetMeshName() const
#define VISU_ColoredPrs3d_i_HeaderFile
#include "VISU_Prs3d_i.hh"
+#include "SALOME_GenericObjPointer.hh"
class VISU_ScalarMapPL;
namespace VISU
{
+ //----------------------------------------------------------------------------
+ struct TMinMaxController
+ {
+ virtual
+ vtkFloatingPointType
+ GetComponentMin(vtkIdType theCompID);
+
+ virtual
+ vtkFloatingPointType
+ GetComponentMax(vtkIdType theCompID);
+
+ virtual
+ void
+ Register() = 0;
+
+ virtual
+ void
+ Destroy() = 0;
+ };
+ typedef SALOME::GenericObjPtr<TMinMaxController> PMinMaxController;
+
+
+ //----------------------------------------------------------------------------
+ struct TVTKMinMaxController: virtual TMinMaxController,
+ virtual vtkObjectBase
+ {
+ virtual
+ void
+ Register()
+ {
+ vtkObjectBase::Register(NULL);
+ }
+
+ virtual
+ void
+ Destroy()
+ {
+ vtkObjectBase::Delete();
+ }
+ };
+
+
+ //----------------------------------------------------------------------------
+ class ColoredPrs3d_i;
+
+ PMinMaxController
+ CreateDefaultMinMaxController(VISU::ColoredPrs3d_i* theColoredPrs3d);
+
+
//============================================================================
class ColoredPrs3d_i : public virtual POA_VISU::ColoredPrs3d,
+ public virtual TMinMaxController,
public virtual Prs3d_i
{
ColoredPrs3d_i();
virtual
~ColoredPrs3d_i();
+ virtual
+ void
+ Register();
+
+ virtual
+ void
+ Destroy();
+
virtual
void
RemoveFromStudy();
CORBA::Double
GetMax();
+ virtual
+ void
+ SetRange(CORBA::Double theMin, CORBA::Double theMax);
+
+ virtual
+ vtkFloatingPointType
+ GetComponentMin(vtkIdType theCompID);
+
+ virtual
+ vtkFloatingPointType
+ GetComponentMax(vtkIdType theCompID);
+
+ virtual
+ void
+ SetSourceRange();
+
+ virtual
+ CORBA::Double
+ GetSourceMin();
+
+ virtual
+ CORBA::Double
+ GetSourceMax();
+
+ virtual
+ bool
+ IsRangeFixed();
+
virtual
void
SetNbColors(CORBA::Long theNbColors);
int theIteration,
bool theIsFixedRange);
- virtual const VISU::PField&
+ virtual
+ const VISU::PField&
GetField() const;
virtual
CORBA::Boolean
IsTimeStampFixed();
+
+ VISU::PMinMaxController
+ GetMinMaxController();
+
+ void
+ SetMinMaxController(const VISU::PMinMaxController& theController);
+
const std::string&
GetMeshName() const;
//----------------------------------------------------------------------------
protected:
PField myField;
+ PMinMaxController myMinMaxController;
+
TEntity myEntity;
std::string myFieldName;
int myIteration;
if(const ScalarMap_i* aPrs3d = dynamic_cast<const ScalarMap_i*>(theOrigin)){
ScalarMap_i* anOrigin = const_cast<ScalarMap_i*>(aPrs3d);
- SetRange(anOrigin->GetMin(), anOrigin->GetMax());
- myIsFixedRange = anOrigin->IsRangeFixed();
-
SetScaling(anOrigin->GetScaling());
Update();
VISU::ScalarMap_i
::SetRange(CORBA::Double theMin, CORBA::Double theMax)
{
- if(theMin > theMax)
- return;
-
- struct TEvent: public SALOME_Event {
- VISU_ScalarMapPL* myMap;
- vtkFloatingPointType myRange[2];
- TEvent( VISU_ScalarMapPL* theMap, const vtkFloatingPointType& theMin , const vtkFloatingPointType& theMax)
- :myMap(theMap)
- {
- myRange[0] = theMin;
- myRange[1] = theMax;
- }
-
- virtual
- void
- Execute()
- {
- myMap->SetScalarRange(myRange);
- }
- };
-
- ProcessVoidEvent(new TEvent(myScalarMapPL, theMin, theMax));
- myIsFixedRange = true;
+ TSuperClass::SetRange(theMin, theMax);
}
myScalarMapPL->SetMapScale(theMapScale);
}
-//----------------------------------------------------------------------------
-bool
-VISU::ScalarMap_i
-::IsRangeFixed()
-{
- return myIsFixedRange;
-}
-
-//----------------------------------------------------------------------------
-void
-VISU::ScalarMap_i
-::SetSourceRange()
-{
- if(IsTimeStampFixed()){
- ProcessVoidEvent(new TVoidMemFunEvent<VISU_ScalarMapPL>
- (myScalarMapPL, &VISU_ScalarMapPL::SetSourceRange));
- }else{
- TMinMax aTMinMax = GetField()->GetMinMax(GetScalarMode());
- vtkFloatingPointType aScalarRange[2] = {aTMinMax.first, aTMinMax.second};
- ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_ScalarMapPL, vtkFloatingPointType*>
- (myScalarMapPL, &VISU_ScalarMapPL::SetScalarRange, aScalarRange));
- }
-
- myIsFixedRange = false;
-}
-
-//----------------------------------------------------------------------------
-CORBA::Double
-VISU::ScalarMap_i
-::GetSourceMin()
-{
- if(IsTimeStampFixed()){
- vtkFloatingPointType aRange[2];
- myScalarMapPL->GetSourceRange(aRange);
- return aRange[0];
- }else{
- TMinMax aTMinMax = GetField()->GetMinMax(GetScalarMode());
- return aTMinMax.first;
- }
-}
-
-//----------------------------------------------------------------------------
-CORBA::Double
-VISU::ScalarMap_i
-::GetSourceMax()
-{
- if(IsTimeStampFixed()){
- vtkFloatingPointType aRange[2];
- myScalarMapPL->GetSourceRange(aRange);
- return aRange[1];
- }else{
- TMinMax aTMinMax = GetField()->GetMinMax(GetScalarMode());
- return aTMinMax.second;
- }
-}
-
//----------------------------------------------------------------------------
VISU_Actor*
VISU::ScalarMap_i
void
SetMapScale(double theMapScale = 1.0);
- virtual
- bool
- IsRangeFixed();
-
- virtual
- void
- SetSourceRange();
-
- virtual
- CORBA::Double
- GetSourceMin();
-
- virtual
- CORBA::Double
- GetSourceMax();
-
virtual
void
SameAs(const Prs3d_i* theOrigin);
#include "CASCatch.hxx"
#endif
-using namespace std;
-
-namespace VISU {
- class ExecutionState {
+namespace VISU
+{
+ //------------------------------------------------------------------------
+ class ExecutionState
+ {
bool myIsActive;
QMutex myIsActiveMutex;
public:
return state;
}
};
+
+ //------------------------------------------------------------------------
+ struct TCompositeMinMaxController : virtual TVTKMinMaxController
+ {
+ typedef std::vector<VISU::PMinMaxController> TMinMaxContainer;
+ TMinMaxContainer myMinMaxContainer;
+
+ void
+ AddController(VISU::PMinMaxController theMinMaxController)
+ {
+ myMinMaxContainer.push_back(theMinMaxController);
+ }
+
+ virtual
+ vtkFloatingPointType
+ GetComponentMin(vtkIdType theCompID)
+ {
+ vtkFloatingPointType aMin = TMinMaxController::GetComponentMin(theCompID);
+ if(!myMinMaxContainer.empty()){
+ for(size_t anId = 0; anId < myMinMaxContainer.size(); anId++){
+ VISU::PMinMaxController aMinMaxController = myMinMaxContainer[anId];
+ aMin = std::min(aMin, aMinMaxController->GetComponentMin(theCompID));
+ }
+ }
+ return aMin;
+ }
+
+ virtual
+ vtkFloatingPointType
+ GetComponentMax(vtkIdType theCompID)
+ {
+ vtkFloatingPointType aMax = TMinMaxController::GetComponentMax(theCompID);
+ if(!myMinMaxContainer.empty()){
+ for(size_t anId = 0; anId < myMinMaxContainer.size(); anId++){
+ VISU::PMinMaxController aMinMaxController = myMinMaxContainer[anId];
+ aMax = std::max(aMax, aMinMaxController->GetComponentMax(theCompID));
+ }
+ }
+ return aMax;
+ }
+ };
+
+ typedef SALOME::GenericObjPtr<TCompositeMinMaxController> PCompositeMinMaxController;
}
//------------------------------------------------------------------------
else
myFieldsAbsFrames.push_back(aData.myNbFrames);
}
- if ((theFieldNum == getNbFields() - 1) && aData.myPrsType != VISU::TGAUSSPOINTS){
- double aMin = getMinFieldsValue(myFieldsLst);
- double aMax = getMaxFieldsValue(myFieldsLst);
- for (int i = 0; i < getNbFields(); i++)
- for(long aFrameId = 0; aFrameId < myFieldsLst[i].myNbFrames; aFrameId++)
- if (aData.myPrsType == VISU::TISOSURFACE) {
- if (VISU::IsoSurfaces_i* aPrs = dynamic_cast<VISU::IsoSurfaces_i*>(myFieldsLst[i].myPrs[aFrameId]))
- aPrs->SetSubRange(aMin, aMax);
+
+ if (theFieldNum == getNbFields() - 1) {
+ if ( aData.myPrsType != VISU::TGAUSSPOINTS) {
+
+ // Initialize the MinMax controller
+ VISU::PCompositeMinMaxController aMinMaxController(new VISU::TCompositeMinMaxController());
+ if ( myAnimationMode == VISU::Animation::PARALLEL ) {
+ FieldData& aFieldData = getFieldData(theFieldNum);
+ VISU::ColoredPrs3d_i* aPrs3d = aFieldData.myPrs[0];
+ aMinMaxController->AddController(VISU::CreateDefaultMinMaxController(aPrs3d));
+ } else {
+ for (int aFieldId = 0; aFieldId < getNbFields(); aFieldId++) {
+ FieldData& aFieldData = getFieldData(aFieldId);
+ VISU::ColoredPrs3d_i* aPrs3d = aFieldData.myPrs[0];
+ aMinMaxController->AddController(VISU::CreateDefaultMinMaxController(aPrs3d));
}
- else
- if (VISU::ScalarMap_i* aPrs = dynamic_cast<VISU::ScalarMap_i*>(myFieldsLst[i].myPrs[aFrameId]))
- aPrs->SetRange(aMin, aMax);
+ }
+
+ double aMin = getMinFieldsValue(myFieldsLst);
+ double aMax = getMaxFieldsValue(myFieldsLst);
+
+ for (int aFieldId = 0; aFieldId < getNbFields(); aFieldId++) {
+ FieldData& aFieldData = getFieldData(aFieldId);
+ for (long aFrameId = 0; aFrameId < aFieldData.myNbFrames; aFrameId++) {
+ VISU::ColoredPrs3d_i* aPrs3d = aFieldData.myPrs[aFrameId];
+ aPrs3d->SetMinMaxController(aMinMaxController);
+ if (VISU::IsoSurfaces_i* anIsoSurfaces = dynamic_cast<VISU::IsoSurfaces_i*>(aPrs3d))
+ anIsoSurfaces->SetSubRange(aMin, aMax);
+ }
+ }
+ }
}
}
}