Esempio n. 1
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;
}
Esempio n. 2
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;
                }
            }
        }

    }
}
Esempio n. 3
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() );
        }
    }
}