示例#1
0
void TransferFunctionEditor::setTransferFunction( const kvs::TransferFunction& transfer_function )
{
    const kvs::ColorMap& cmap = transfer_function.colorMap();
    const kvs::OpacityMap& omap = transfer_function.opacityMap();

    // Deep copy for the initial transfer function.
    kvs::ColorMap::Table color_map_table( cmap.table().data(), cmap.table().size() );
    kvs::OpacityMap::Table opacity_map_table( omap.table().data(), omap.table().size() );
//    kvs::ColorMap color_map( color_map_table, cmap.minValue(), cmap.maxValue() );
//    kvs::OpacityMap opacity_map( opacity_map_table, omap.minValue(), omap.maxValue() );
    kvs::ColorMap color_map( color_map_table );
    kvs::OpacityMap opacity_map( opacity_map_table );
    m_initial_transfer_function.setColorMap( color_map );
    m_initial_transfer_function.setOpacityMap( opacity_map );

    if ( transfer_function.hasRange() )
    {
        m_min_value = transfer_function.colorMap().minValue();
        m_max_value = transfer_function.colorMap().maxValue();
        m_initial_transfer_function.setRange( m_min_value, m_max_value );
    }

    m_color_map_palette->setColorMap( color_map );
    m_opacity_map_palette->setOpacityMap( opacity_map );

    m_undo_stack.clear();
    m_undo_stack.push_front( m_initial_transfer_function );
}
示例#2
0
void OpacityMapPalette::setOpacityMap( const kvs::OpacityMap& opacity_map )
{
    // Deep copy.
    kvs::OpacityMap::Table opacity_map_table( opacity_map.table().data(), opacity_map.table().size() );
    m_opacity_map = kvs::OpacityMap( opacity_map_table );
}
示例#3
0
const kvs::OpacityMap OpacityMapPalette::opacityMap() const
{
    // Deep copy.
    kvs::OpacityMap::Table opacity_map_table( m_opacity_map.table().data(), m_opacity_map.table().size() );
    return kvs::OpacityMap( opacity_map_table );
}