swh:1:snp:6088ab52ef49920e01e3f334cdf4d5d6c8a822b9
Raw File
Tip revision: 8617adcabc093f1d703b7eae2b3814600d8a6e64 authored by Lars Bilke on 26 April 2021, 08:10:43 UTC
Fix build without XDMF.
Tip revision: 8617adc
ColorLookupTable.cpp
/**
 * \copyright
 * Copyright (c) 2012-2021, OpenGeoSys Community (http://www.opengeosys.org)
 *            Distributed under a Modified BSD License.
 *              See accompanying file LICENSE.txt or
 *              http://www.opengeosys.org/project/license
 *
 */

#include "ColorLookupTable.h"

#include <limits>

namespace DataHolderLib
{
ColorLookupTable::ColorLookupTable()
    : _range(
          std::make_pair<double, double>(std::numeric_limits<double>::lowest(),
                                         std::numeric_limits<double>::max()))

{
}

void ColorLookupTable::setTableRange(double min, double max)
{
    if (min < max)
    {
        _range = std::make_pair(min, max);
    }
}

void ColorLookupTable::setColor(double id, DataHolderLib::Color const& color)
{
    if ((id > _range.first) && (id < _range.second))
    {
        _lut.emplace_back(id, color, "");
    }
}

void ColorLookupTable::setColor(std::string const& name,
                                DataHolderLib::Color const& color)
{
    _lut.emplace_back(0, color, name);
}

}  // namespace DataHolderLib
back to top