void VtkCompositeColorByHeightFilter::init()
{
    this->_inputDataObjectType = VTK_DATA_SET;
    this->_outputDataObjectType = VTK_POLY_DATA;

    vtkSmartPointer<vtkDataSetSurfaceFilter> surfaceFilter;
    VtkColorByHeightFilter* heightFilter = VtkColorByHeightFilter::New();

    if (dynamic_cast<vtkUnstructuredGrid*>(_inputAlgorithm->GetOutputDataObject(0)))
    {
        surfaceFilter = vtkSmartPointer<vtkDataSetSurfaceFilter>::New();
        surfaceFilter->SetInputConnection(_inputAlgorithm->GetOutputPort());
        heightFilter->SetInputConnection(surfaceFilter->GetOutputPort());
    }
    else
        heightFilter->SetInputConnection(_inputAlgorithm->GetOutputPort());

    DataHolderLib::Color a = { 0, 0, 255, 255 }; // blue
    DataHolderLib::Color b = { 0, 255, 0, 255 }; // green
    DataHolderLib::Color c = { 255, 255, 0, 255 }; // yellow
    DataHolderLib::Color d = { 155, 100, 50, 255 }; // brown
    DataHolderLib::Color e = { 255, 0, 0, 255 }; // red
    VtkColorLookupTable* ColorLookupTable = heightFilter->GetColorLookupTable();
    ColorLookupTable->setInterpolationType(DataHolderLib::LUTType::LINEAR);
    ColorLookupTable->setColor(-50, a);
    ColorLookupTable->setColor(0, a);
    ColorLookupTable->setColor(1, b);   // instant change at 0m a.s.l.
    ColorLookupTable->setColor(200, b); // green at about 200m a.s.l.
    ColorLookupTable->setColor(500, c); // yellow at about 500m and changing to red from then on
    ColorLookupTable->setColor(1000, d);
    ColorLookupTable->setColor(2000, e);
    ColorLookupTable->SetTableRange(-35, 2000);
    ColorLookupTable->Build();

    // This passes ownership of the ColorLookupTable to VtkVisPointSetItem
    heightFilter->SetLookUpTable("P-Colors", ColorLookupTable);
    heightFilter->Update();

    _outputAlgorithm = heightFilter;
    _activeAttributeName = heightFilter->GetActiveAttribute();
}
VtkColorLookupTable* VtkCompositeElementSelectionFilter::GetLookupTable()
{
	VtkColorLookupTable* lut = VtkColorLookupTable::New();
	lut->SetTableRange(0,1);
	unsigned char a[4] = { 0, 0, 255, 255 }; // blue
	unsigned char b[4] = { 0, 255, 0, 255 }; // green
	unsigned char c[4] = { 255, 255, 0, 255 }; // yellow
	unsigned char d[4] = { 255, 0, 0, 255 }; // red
	lut->setColor(1.0, a);
	lut->setColor(0.5, b);
	lut->setColor(0.25, c);
	lut->setColor(0.1, d);
	lut->Build();
	return lut;
}
VtkColorLookupTable* VtkCompositeElementSelectionFilter::GetLookupTable()
{
    VtkColorLookupTable* lut = VtkColorLookupTable::New();
    lut->SetTableRange(0,1);
    DataHolderLib::Color a{{0, 0, 255, 255}};   // blue
    DataHolderLib::Color b{{0, 255, 0, 255}};   // green
    DataHolderLib::Color c{{255, 255, 0, 255}};  // yellow
    DataHolderLib::Color d{{255, 0, 0, 255}};    // red
    lut->setColor(1.0, a);
    lut->setColor(0.5, b);
    lut->setColor(0.25, c);
    lut->setColor(0.1, d);
    lut->Build();
    return lut;
}