Upcasting vtkSmartPointer

(Paulo Carvalho) #1

Greetings,

The (legacy) code below that used to compile:

 vtkSmartPointer<vtkLookupTable> lut = Util::getColorTable( ColorTable::RAINBOW, min, max);
 ...
 pointCloudMapper->SetLookupTable(lut);

Now I get no known conversion for argument 1 from 'vtkSmartPointer<vtkLookupTable>' to 'vtkScalarsToColors*' what gives? As far as I know vtkLookupTable inherits from vtkScalarsToColors. How do I upcast the smart pointer? I can’t change the type of pointer returned by the getColorTable() function.

any help will be much appreciated.

Paulo

(Andras Lasso) #2

There is no such thing as upcasting (it is implicit). Make sure to #include all related header files.

(Paulo Carvalho) #3

True… there was missing an include that was being included indirectly in the legacy code. Thanks for the heads up.