#include "VISU_ScalarMapPL.hxx"
#include "VISU_PipeLineUtils.hxx"
+
+//============================================================================
vtkStandardNewMacro(VISU_ScalarMapPL);
-VISU_ScalarMapPL::VISU_ScalarMapPL(){
+//----------------------------------------------------------------------------
+VISU_ScalarMapPL
+::VISU_ScalarMapPL()
+{
myFieldTransform = VISU_FieldTransform::New();
- //myFieldTransform->DebugOn();
myMapperTable = VISU_LookupTable::New();
myMapperTable->SetScale(VTK_SCALE_LINEAR);
myBarTable->SetHueRange(0.667,0.0);
myExtractor = VISU_Extractor::New();
- //myExtractor->DebugOn();
+
myIsShrinkable = true;
}
-VISU_ScalarMapPL::~VISU_ScalarMapPL(){
- myFieldTransform->UnRegisterAllOutputs();
+VISU_ScalarMapPL
+::~VISU_ScalarMapPL()
+{
myFieldTransform->Delete();
- myMapperTable->Delete();;
+ myMapperTable->Delete();
myBarTable->Delete();
- myExtractor->UnRegisterAllOutputs();
myExtractor->Delete();
}
-void VISU_ScalarMapPL::ShallowCopy(VISU_PipeLine *thePipeLine){
- VISU_PipeLine::ShallowCopy(thePipeLine);
+//----------------------------------------------------------------------------
+void
+VISU_ScalarMapPL
+::ShallowCopy(VISU_PipeLine *thePipeLine)
+{
if(VISU_ScalarMapPL *aPipeLine = dynamic_cast<VISU_ScalarMapPL*>(thePipeLine)){
SetScalarRange(aPipeLine->GetScalarRange());
SetScalarMode(aPipeLine->GetScalarMode());
SetNbColors(aPipeLine->GetNbColors());
SetScaling(aPipeLine->GetScaling());
- Update(); // apo-gauss
+ Update();
}
+ Superclass::ShallowCopy(thePipeLine);
}
-int VISU_ScalarMapPL::GetScalarMode(){
+//----------------------------------------------------------------------------
+int
+VISU_ScalarMapPL
+::GetScalarMode()
+{
return myExtractor->GetScalarMode();
}
-void VISU_ScalarMapPL::SetScalarMode(int theScalarMode){
+
+void
+VISU_ScalarMapPL
+::SetScalarMode(int theScalarMode)
+{
myExtractor->SetScalarMode(theScalarMode);
Modified();
}
-int VISU_ScalarMapPL::GetScaling() {
+//----------------------------------------------------------------------------
+int
+VISU_ScalarMapPL
+::GetScaling()
+{
return myBarTable->GetScale();
}
-void VISU_ScalarMapPL::SetScaling(int theScaling) {
+
+void
+VISU_ScalarMapPL
+::SetScaling(int theScaling)
+{
myBarTable->SetScale(theScaling);
if(theScaling == VTK_SCALE_LOG10)
myFieldTransform->SetScalarTransform(&(VISU_FieldTransform::Log10));
}
-float* VISU_ScalarMapPL::GetScalarRange() {
+//----------------------------------------------------------------------------
+float*
+VISU_ScalarMapPL
+::GetScalarRange()
+{
return myFieldTransform->GetScalarRange();
}
-void VISU_ScalarMapPL::SetScalarRange(float theRange[2]){
+
+void
+VISU_ScalarMapPL
+::SetScalarRange(float theRange[2])
+{
myFieldTransform->SetScalarRange(theRange);
myBarTable->SetRange(theRange);
Modified();
}
-void VISU_ScalarMapPL::SetScalarMin(float theValue){
+
+void
+VISU_ScalarMapPL
+::SetScalarMin(float theValue)
+{
float aScalarRange[2] = {theValue, GetScalarRange()[1]};
SetScalarRange(aScalarRange);
}
-void VISU_ScalarMapPL::SetScalarMax(float theValue){
+
+void
+VISU_ScalarMapPL
+::SetScalarMax(float theValue)
+{
float aScalarRange[2] = {GetScalarRange()[0], theValue};
SetScalarRange(aScalarRange);
}
-void VISU_ScalarMapPL::SetNbColors(int theNbColors) {
+//----------------------------------------------------------------------------
+void
+VISU_ScalarMapPL
+::SetNbColors(int theNbColors)
+{
myMapperTable->SetNumberOfColors(theNbColors);
myBarTable->SetNumberOfColors(theNbColors);
Modified();
}
-int VISU_ScalarMapPL::GetNbColors() {
+
+int
+VISU_ScalarMapPL
+::GetNbColors()
+{
return myMapperTable->GetNumberOfColors();
}
-VISU_ScalarMapPL::THook* VISU_ScalarMapPL::DoHook(){
+//----------------------------------------------------------------------------
+VISU_ScalarMapPL::THook*
+VISU_ScalarMapPL
+::DoHook()
+{
myMapper->SetColorModeToMapScalars();
myMapper->ScalarVisibilityOn();
return myFieldTransform->GetUnstructuredGridOutput();
}
-void VISU_ScalarMapPL::Init(){
+void
+VISU_ScalarMapPL
+::Init()
+{
//SetSourceRange();
}
-void VISU_ScalarMapPL::Build() {
+void
+VISU_ScalarMapPL
+::Build()
+{
myExtractor->SetInput(GetInput2());
myFieldTransform->SetInput(myExtractor->GetOutput());
myMapper->SetInput(DoHook());
+ Update();
}
-void VISU_ScalarMapPL::Update() {
+void
+VISU_ScalarMapPL
+::Update()
+{
float *aRange = myFieldTransform->GetScalarRange();
float aScalarRange[2] = {aRange[0], aRange[1]};
if(myBarTable->GetScale() == VTK_SCALE_LOG10)
}
-void VISU_ScalarMapPL::SetMapScale(float theMapScale){
+//----------------------------------------------------------------------------
+VISU_LookupTable *
+VISU_ScalarMapPL
+::GetMapperTable()
+{
+ return myMapperTable;
+}
+
+VISU_LookupTable*
+VISU_ScalarMapPL
+::GetBarTable()
+{
+ return myBarTable;
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_ScalarMapPL
+::SetMapScale(float theMapScale)
+{
myMapperTable->SetMapScale(theMapScale);
myMapperTable->Build();
}
-float VISU_ScalarMapPL::GetMapScale(){
+
+float
+VISU_ScalarMapPL::GetMapScale()
+{
return myMapperTable->GetMapScale();
}
-void VISU_ScalarMapPL::GetSourceRange(float theRange[2]){
+//----------------------------------------------------------------------------
+void
+VISU_ScalarMapPL
+::GetSourceRange(float theRange[2])
+{
myExtractor->Update();
myExtractor->GetOutput()->GetScalarRange(theRange);
}
-void VISU_ScalarMapPL::SetSourceRange(){
+void
+VISU_ScalarMapPL
+::SetSourceRange()
+{
float aRange[2];
GetSourceRange(aRange);
SetScalarRange(aRange);
#include "VISU_PipeLine.hxx"
#include "VISU_ScalarBarActor.hxx"
-class vtkDataSet;
class vtkCell;
+class vtkDataSet;
+
class VISU_Extractor;
class VISU_FieldTransform;
-class VISU_ScalarMapPL : public VISU_PipeLine{
+
+//============================================================================
+class VISU_ScalarMapPL : public VISU_PipeLine
+{
protected:
VISU_ScalarMapPL();
VISU_ScalarMapPL(const VISU_ScalarMapPL&);
+
+ virtual
+ ~VISU_ScalarMapPL();
+
public:
+ //----------------------------------------------------------------------------
vtkTypeMacro(VISU_ScalarMapPL,VISU_PipeLine);
- static VISU_ScalarMapPL* New();
- virtual ~VISU_ScalarMapPL();
- virtual void ShallowCopy(VISU_PipeLine *thePipeLine);
- virtual int GetScalarMode();
- virtual void SetScalarMode(int theScalarMode = 0);
+ static
+ VISU_ScalarMapPL*
+ New();
+
+ virtual
+ void
+ ShallowCopy(VISU_PipeLine *thePipeLine);
+
+ //----------------------------------------------------------------------------
+ virtual
+ int
+ GetScalarMode();
+
+ virtual
+ void
+ SetScalarMode(int theScalarMode = 0);
- virtual int GetScaling();
- virtual void SetScaling(int theScaling = VTK_SCALE_LINEAR);
+ virtual
+ int
+ GetScaling();
+ virtual
+ void
+ SetScaling(int theScaling = VTK_SCALE_LINEAR);
- virtual float* GetScalarRange();
- virtual void SetScalarRange(float theRange[2]);
- virtual void SetScalarMin(float theValue);
- virtual void SetScalarMax(float theValue);
+ virtual
+ float*
+ GetScalarRange();
+
+ virtual
+ void
+ SetScalarRange(float theRange[2]);
+
+ virtual
+ void
+ SetScalarMin(float theValue);
+
+ virtual
+ void
+ SetScalarMax(float theValue);
- virtual void SetNbColors(int theNbColors = 16);
- virtual int GetNbColors();
+ virtual
+ void
+ SetNbColors(int theNbColors = 16);
+
+ virtual
+ int
+ GetNbColors();
+ //----------------------------------------------------------------------------
public:
- virtual void Init();
- virtual void Build();
- virtual void Update();
+ virtual
+ void
+ Init();
+
+ virtual
+ void
+ Build();
+
+ virtual
+ void
+ Update();
- virtual VISU_LookupTable *GetMapperTable(){ return myMapperTable;}
- virtual VISU_LookupTable *GetBarTable(){ return myBarTable;}
+ virtual
+ VISU_LookupTable*
+ GetMapperTable();
+
+ virtual
+ VISU_LookupTable*
+ GetBarTable();
+
+ virtual
+ void
+ SetMapScale(float theMapScale = 1.0);
+
+ virtual
+ float
+ GetMapScale();
- virtual void SetMapScale(float theMapScale = 1.0);
- virtual float GetMapScale();
+ virtual
+ void
+ GetSourceRange(float theRange[2]);
- virtual void GetSourceRange(float theRange[2]);
- virtual void SetSourceRange();
+ virtual
+ void
+ SetSourceRange();
+ //----------------------------------------------------------------------------
protected:
typedef vtkDataSet THook;
virtual THook* DoHook();
- VISU_LookupTable *myMapperTable, *myBarTable;
- VISU_FieldTransform *myFieldTransform;
+ VISU_LookupTable* myMapperTable;
+ VISU_LookupTable* myBarTable;
+ VISU_FieldTransform* myFieldTransform;
VISU_Extractor* myExtractor;
};