Commit 337dadb5 authored by David Rogers's avatar David Rogers
Browse files

Fixed bug in log coloring: Only class 'vtkLogLookupTable' was being considered...

Fixed bug in log coloring: Only class 'vtkLogLookupTable' was being considered when determining if log coloring was active.  vtkLookupTable and all of its subclasses can have log coloring, which should be handled by the new code.
parent 4f0a4111
...@@ -24,9 +24,9 @@ ...@@ -24,9 +24,9 @@
#include "vtkTextProperty.h" #include "vtkTextProperty.h"
#include "vtkViewport.h" #include "vtkViewport.h"
#include "vtkWindow.h" #include "vtkWindow.h"
#include "vtkLogLookupTable.h" #include "vtkLookupTable.h"
vtkCxxRevisionMacro(vtkScalarBarActor, "1.55"); vtkCxxRevisionMacro(vtkScalarBarActor, "1.56");
vtkStandardNewMacro(vtkScalarBarActor); vtkStandardNewMacro(vtkScalarBarActor);
vtkCxxSetObjectMacro(vtkScalarBarActor,LookupTable,vtkScalarsToColors); vtkCxxSetObjectMacro(vtkScalarBarActor,LookupTable,vtkScalarsToColors);
...@@ -243,10 +243,24 @@ int vtkScalarBarActor::RenderOpaqueGeometry(vtkViewport *viewport) ...@@ -243,10 +243,24 @@ int vtkScalarBarActor::RenderOpaqueGeometry(vtkViewport *viewport)
// Build scalar bar object; determine its type // Build scalar bar object; determine its type
// //
vtkScalarsToColors *lut = this->LookupTable; // is this a vtkLookupTable or a subclass of vtkLookupTable
int isLogTable = lut->IsA("vtkLogLookupTable"); // with its scale set to log
// NOTE: it's possible we could to without the 'lut' variable
// later in the code, but if the vtkLookupTableSafeDownCast operation
// fails for some reason, this code will break in new ways. So, the 'LUT'
// variable is used for this operation only
vtkLookupTable *LUT = vtkLookupTable::SafeDownCast( this->LookupTable );
int isLogTable = 0;
if ( LUT )
{
if ( LUT->GetScale() == VTK_SCALE_LOG10 )
{
isLogTable = 1;
}
}
// we hard code how many steps to display // we hard code how many steps to display
vtkScalarsToColors *lut = this->LookupTable;
int numColors = this->MaximumNumberOfColors; int numColors = this->MaximumNumberOfColors;
double *range = lut->GetRange(); double *range = lut->GetRange();
...@@ -533,8 +547,17 @@ void vtkScalarBarActor::AllocateAndSizeLabels(int *labelSize, ...@@ -533,8 +547,17 @@ void vtkScalarBarActor::AllocateAndSizeLabels(int *labelSize,
// created, text properties are created and shallow-assigned a font size // created, text properties are created and shallow-assigned a font size
// which value might be "far" from the target font size). // which value might be "far" from the target font size).
vtkScalarsToColors *lut = this->LookupTable; // is this a vtkLookupTable or a subclass of vtkLookupTable
int isLogTable = lut->IsA("vtkLogLookupTable"); // with its scale set to log
vtkLookupTable *LUT = vtkLookupTable::SafeDownCast( this->LookupTable );
int isLogTable = 0;
if ( LUT )
{
if ( LUT->GetScale() == VTK_SCALE_LOG10 )
{
isLogTable = 1;
}
}
for (i=0; i < this->NumberOfLabels; i++) for (i=0; i < this->NumberOfLabels; i++)
{ {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment