Ejemplo n.º 1
0
void
MSPropertyForm::render( std::ostream& o, const portfolio::Folium& folium )
{
    using adportable::utf;

    o << "<em>" << folium.fullpath() << "</em>";

    o << "<table border=\"1\" cellpadding=\"4\">";
    o << "<caption>File information</caption>";
    o << "<tr>";
    for ( auto att: folium.attributes() )
        o << "<th>" << utf::to_utf8( att.first ) << "</th>";
    o << "</tr> <tr>";
    for ( auto att: folium.attributes() )
        o << "<td>" << utf::to_utf8( att.second ) << "</th>";
    o << "</tr>";
    o << "</table>";

    if ( folium.dataClass() == adcontrols::MassSpectrum::dataClass() ) {
        try {
            const adcontrols::MassSpectrumPtr ptr = boost::any_cast< adcontrols::MassSpectrumPtr >( folium.data() );
            if ( ptr ) 
                render( o, *ptr );
        } catch( std::exception() ) {
        }
    }
}
Ejemplo n.º 2
0
bool
QuanSampleProcessor::fetch( portfolio::Folium& folium )
{
    try {
        folium = datafile_->fetch( folium.id(), folium.dataClass() );
        portfolio::Folio attachs = folium.attachments();
        for ( auto att : attachs ) {
            if ( att.empty() )
                fetch( att ); // recursive call make sure for all blongings load up in memory.
        }
    }
    catch ( std::bad_cast& ) {}
    return true;
}
Ejemplo n.º 3
0
void
SessionManager::updateDataprocessor( Dataprocessor* dataprocessor, portfolio::Folium& folium )
{
    activeDataprocessor_ = dataprocessor;

    emit onSessionUpdated( dataprocessor, QString::fromStdWString( folium.id() ) );
}
Ejemplo n.º 4
0
void
SpectrogramWnd::handleSelectionChanged( Dataprocessor*, portfolio::Folium& folium )
{
    portfolio::Folder folder = folium.parentFolder();

    if ( folder && folder.name() == L"Spectrograms" ) {
        adcontrols::MassSpectraPtr ptr;
        if ( portfolio::Folium::get< adcontrols::MassSpectraPtr >( ptr, folium ) ) {
            foliumId_ = folium.id();
            fullpath_ = folium.fullpath();
            data_ = ptr;
            plot_->setData( new detail::SpectrogramData( ptr ) );
        }
        portfolio::Folio atts = folium.attachments();
        portfolio::Folio::iterator it
            = portfolio::Folium::find< adcontrols::SpectrogramClustersPtr >( atts.begin(), atts.end() );
        if ( it != atts.end() ) {
            adcontrols::SpectrogramClustersPtr clusters = boost::any_cast< adcontrols::SpectrogramClustersPtr >( *it );
            plot_->setData( clusters.get() );
        }
    }
}
Ejemplo n.º 5
0
void
ElementalCompWnd::handleSelectionChanged( Dataprocessor* /* processor */, portfolio::Folium& folium )
{
    pImpl_->drawIdx_ = 0;

    adutils::ProcessedData::value_type data = adutils::ProcessedData::toVariant( static_cast<boost::any&>( folium ) );

    if ( portfolio::is_type< adcontrols::MassSpectrumPtr >( folium ) ) {

        if ( auto ptr = portfolio::get< adcontrols::MassSpectrumPtr >( folium ) ) {
            if ( ptr->size() > 0
                 && adportable::compare<double>::approximatelyEqual( ptr->getMass( ptr->size() - 1 ), ptr->getMass( 0 ) ) ) {
                // no mass assigned
                pImpl_->processedSpectrum_->setAxis( adplot::SpectrumWidget::HorizontalAxisTime, false );
            } else {
                pImpl_->processedSpectrum_->setAxis( adplot::SpectrumWidget::HorizontalAxisMass, false );
            }
            pImpl_->referenceSpectrum_->enableAxis( QwtPlot::yRight, true );            
            pImpl_->processedSpectrum_->enableAxis( QwtPlot::yRight, true );
            pImpl_->processedSpectrum_->setData( ptr, 1, true );
            pImpl_->processedSpectrum_->setAlpha( 1, 0x20 );
        }

        portfolio::Folio attachments = folium.attachments();
        if ( auto fcentroid = portfolio::find_first_of( folium.attachments(), []( const portfolio::Folium& a ){
                    return a.name() == Constants::F_CENTROID_SPECTRUM; }) ) {
        
            if ( auto centroid = portfolio::get< adcontrols::MassSpectrumPtr >( fcentroid ) ) {
                if ( centroid->isCentroid() ) {
                    pImpl_->processedSpectrum_->setData( centroid, 0, false );
                    pImpl_->centroid_ = centroid;
                }
            }
        }

    }
}
Ejemplo n.º 6
0
void
SessionManager::selectionChanged( Dataprocessor* dataprocessor, portfolio::Folium& folium )
{
    adportable::debug(__FILE__, __LINE__) << static_cast<boost::any&>(folium).type().name() << ", id=" << folium.id();
    activeDataprocessor_ = dataprocessor;
    emit signalSelectionChanged( dataprocessor, folium );
}