Пример #1
0
void TransferFunctionEditor::_publishTransferFunction()
{
    UInt8Vector redCurve =  _redWidget->getCurve();
    UInt8Vector greenCurve =  _greenWidget->getCurve();
    UInt8Vector blueCurve =  _blueWidget->getCurve();
    UInt8Vector alphaCurve =  _alphaWidget->getCurve();

    if( redCurve.empty()
            || greenCurve.empty()
            || blueCurve.empty()
            || alphaCurve.empty())
    {
        return;
    }

    UInt8Vector transferFunction;
    transferFunction.reserve( redCurve.size( ));
    for( uint32_t i = 0; i < redCurve.size(); ++i )
    {
        transferFunction.push_back( redCurve[i] );
        transferFunction.push_back( greenCurve[i] );
        transferFunction.push_back( blueCurve[i] );
        transferFunction.push_back( alphaCurve[i] );
    }
    if( _isConnected && transferFunction.size() == 1024 )
    {
        const servus::URI uri( ui->txtURL->text().toStdString());
        _controller.publish( uri,
                             zeq::hbp::serializeLookupTable1D( transferFunction ));
    }
}
Пример #2
0
void TransferFunctionEditor::_publishTransferFunction()
{
    if( ! _tfReceived )
        return;

    const UInt8Vector& redCurve =  _redWidget->getCurve();
    const UInt8Vector& greenCurve =  _greenWidget->getCurve();
    const UInt8Vector& blueCurve =  _blueWidget->getCurve();
    const UInt8Vector& alphaCurve =  _alphaWidget->getCurve();

    if( redCurve.empty() || greenCurve.empty() || blueCurve.empty() ||
        alphaCurve.empty( ))
    {
        return;
    }

    UInt8Vector transferFunction;
    transferFunction.reserve( redCurve.size() * 4u );
    for( uint32_t i = 0; i < redCurve.size(); ++i )
    {
        transferFunction.push_back( redCurve[i] );
        transferFunction.push_back( greenCurve[i] );
        transferFunction.push_back( blueCurve[i] );
        transferFunction.push_back( alphaCurve[i] );
    }

    if( transferFunction.size() == 1024 )
    {
        _controller.publish( _zeqSchema,
                             zeq::hbp::serializeLookupTable1D( transferFunction ));
    }
}