From f3473396686a6c43615f8647473e4a0e23e34729 Mon Sep 17 00:00:00 2001 From: rkv Date: Thu, 28 Nov 2013 08:12:25 +0000 Subject: [PATCH] Fix for the bug #130: bathymetry sign is wrong: Use negative values again. Scalar bar labels text size is decreased. --- src/HYDROGUI/HYDROGUI_VTKPrs.cxx | 2 +- src/HYDROGUI/HYDROGUI_VTKPrsBathymetry.cxx | 27 +++------------------- src/HYDROGUI/HYDROGUI_VTKPrsDisplayer.cxx | 8 +++++-- 3 files changed, 10 insertions(+), 27 deletions(-) diff --git a/src/HYDROGUI/HYDROGUI_VTKPrs.cxx b/src/HYDROGUI/HYDROGUI_VTKPrs.cxx index 588c7c8d..671a2cdc 100644 --- a/src/HYDROGUI/HYDROGUI_VTKPrs.cxx +++ b/src/HYDROGUI/HYDROGUI_VTKPrs.cxx @@ -69,6 +69,6 @@ void HYDROGUI_VTKPrs::setZRange( double theRange[] ) vtkMapper* aMapper = mapper(); if ( aMapper ) { - mapper()->SetScalarRange( -myZRange[1], -myZRange[0] ); + mapper()->SetScalarRange( myZRange ); } } diff --git a/src/HYDROGUI/HYDROGUI_VTKPrsBathymetry.cxx b/src/HYDROGUI/HYDROGUI_VTKPrsBathymetry.cxx index 84d5b8e7..f1337a17 100644 --- a/src/HYDROGUI/HYDROGUI_VTKPrsBathymetry.cxx +++ b/src/HYDROGUI/HYDROGUI_VTKPrsBathymetry.cxx @@ -34,7 +34,6 @@ #include #include #include -#include #include @@ -116,10 +115,7 @@ void HYDROGUI_VTKPrsBathymetry::compute() // Update the lookup table range if this bathymetry is out of it if ( myLookupTable ) { - double* aRange = aZValues->GetRange(); - myInternalZRange[0] = -aRange[1]; - myInternalZRange[1] = -aRange[0]; - + aZValues->GetRange( myInternalZRange ); double* aGlobalRange = myLookupTable->GetRange(); // If the global range is not yet initialized or the current one is out of scope then update the global bool anIsUpdated = false; @@ -141,27 +137,10 @@ void HYDROGUI_VTKPrsBathymetry::compute() myLookupTable->Build(); } - myMapper->SetScalarRange( -aGlobalRange[1], -aGlobalRange[0] ); + myMapper->SetScalarRange( aGlobalRange ); myMapper->ScalarVisibilityOn(); myMapper->SetScalarModeToUsePointData(); - - - vtkLookupTable* aTable = vtkLookupTable::New(); - vtkLookupTable* aGlobalTable = vtkLookupTable::SafeDownCast( myLookupTable ); - double* aHueRange = aGlobalTable->GetHueRange(); - // Revert hue range to keep it the same as for appropriate positive Z values in scalar bar - aTable->SetHueRange( aHueRange[1], aHueRange[0] ); - aTable->SetSaturationRange( aGlobalTable->GetSaturationRange() ); - // Revert the Z values range from positive to negative to show them as depth - aTable->SetTableRange( -aGlobalRange[1], -aGlobalRange[0] ); - aTable->SetValueRange( aGlobalTable->GetValueRange() ); - aTable->SetAlphaRange( aGlobalTable->GetAlphaRange() ); - aTable->SetNumberOfColors( aGlobalTable->GetNumberOfColors() ); - aTable->Build(); - - myMapper->SetLookupTable( aTable ); - aTable->Delete(); -// myMapper->SetLookupTable( myLookupTable ); + myMapper->SetLookupTable( myLookupTable ); } myMapper->SetInputData( aVertexGrid ); diff --git a/src/HYDROGUI/HYDROGUI_VTKPrsDisplayer.cxx b/src/HYDROGUI/HYDROGUI_VTKPrsDisplayer.cxx index 22912ce3..2b3e55f5 100644 --- a/src/HYDROGUI/HYDROGUI_VTKPrsDisplayer.cxx +++ b/src/HYDROGUI/HYDROGUI_VTKPrsDisplayer.cxx @@ -39,6 +39,7 @@ #include #include +#include #include #include @@ -52,8 +53,8 @@ //#define SATURATION_START 1.0 //#define SATURATION_END 0.4 -#define HUE_START 0.0 -#define HUE_END 0.7 +#define HUE_START 0.7 +#define HUE_END 0.0 #define SATURATION_START 1.0 #define SATURATION_END 1.0 @@ -339,6 +340,9 @@ void HYDROGUI_VTKPrsDisplayer::createScalarBar( const int theViewId ) aTable->Build(); vtkSmartPointer aScalarBar = vtkScalarBarActor::New(); aScalarBar->SetLookupTable( aTable ); + aScalarBar->SetNumberOfLabels( NB_COLORS * 0.75 ); + aScalarBar->SetWidth( aScalarBar->GetWidth() / 1.5 ); + aScalarBar->SetTextureGridWidth( aScalarBar->GetTextureGridWidth() * 4. ); aTable->Delete(); myScalarBars.insert( theViewId, aScalarBar ); } -- 2.39.2