• Cory Quammen's avatar
    Enable coloring by indexed lookup for vtkStringArrays · 94498364
    Cory Quammen authored
    This change makes it possible to map vtkStringArrays to colors using
    indexed lookup mode. The vtkStringArrays may be associated with
    points, cells, or neither (field data). A slew of changes were
    required to give this capability:
    - Changed signature of vtkScalarsToColors::MapScalars(...) and
      vtkDiscretizableColorTransferFunction::MapScalars(...)  to take a
      vtkAbstractArray instead of a vtkDataArray. This enables mapping
      non-vtkDataArray arrays, such as vtkStringArrays. These changes are
      backwards compatible because vtkAbstractArray is the parent class of
    - Changed vtkLookupTable::MapScalarsThroughTable2(...) to handle
    - Changed vtkColorTransferFunction::MapScalarsThroughTable2(...) to handle
    - Added vtkAbstractMapper::GetAbstractScalars(...) that returns a data
      array as a vtkAbstractArray - needed to retrieve vtkStringArray
    - Added some error reporting when unhandled array type is encountered
      in vtkScalarsToColors::MapScalarsThroughTable2.
    - Enabled use of vtkStringArrays for coloring in the surface mappers.
    - Added some tests for mapping vtkStringArrays with
      vtkColorTransferFunction and vtkDiscretizableColorTransferFunction.
    - Added some tests for coloring objects by vtkStringArrays in cell data
      and point data.
    - Added logic to vtkMapper and vtkPolyDataMapper2D that generates a
      reasonable default lookup table when a vtkStringArray or other
      non-numeric array is selected for coloring by scalars. This requires
      making the vtkRenderingCore module depend on vtkCommonColor. Added
      tests for this feature.
    Change-Id: I91e2e451217139a7daabd7f4a63de0b8ff707ad4
vtkScalarsToColorsPainter.cxx 30.3 KB