| 29 | } |
| 30 | |
| 31 | void TVSpectraViewController::showSpectrumAsNew1D(int index) |
| 32 | { |
| 33 | // basic behavior 1 |
| 34 | LayerDataBase& layer = tv_->getActiveCanvas()->getCurrentLayer(); |
| 35 | |
| 36 | // create new 1D widget; if we return due to error, the widget will be cleaned up automatically |
| 37 | unique_ptr<Plot1DWidget> wp(new Plot1DWidget(tv_->getCanvasParameters(1), DIM::Y, (QWidget*)tv_->getWorkspace())); |
| 38 | Plot1DWidget* w = wp.get(); |
| 39 | |
| 40 | // copy data from current layer (keeps the TYPE and underlying data identical) |
| 41 | if (!w->canvas()->addLayer(layer.to1DLayer())) |
| 42 | { |
| 43 | // Behavior if its neither (user may have clicked on an empty tree or a |
| 44 | // dummy entry as drawn by SpectraTreeTab::updateEntries) |
| 45 | QMessageBox::critical(w, "Error", "Cannot open data that is neither chromatogram nor spectrum data. Aborting!"); |
| 46 | return; |
| 47 | } |
| 48 | |
| 49 | w->canvas()->activateSpectrum(index); |
| 50 | |
| 51 | // set visible area to visible area in 2D view |
| 52 | w->canvas()->setVisibleArea(tv_->getActiveCanvas()->getVisibleArea()); |
| 53 | |
| 54 | // set relative (%) view of visible area |
| 55 | w->canvas()->setIntensityMode(PlotCanvas::IM_SNAP); |
| 56 | |
| 57 | tv_->showPlotWidgetInWindow(wp.release()); |
| 58 | tv_->updateLayerBar(); |
| 59 | tv_->updateViewBar(); |
| 60 | tv_->updateFilterBar(); |
| 61 | tv_->updateMenu(); |
| 62 | } |
| 63 | |
| 64 | bool add1DChromLayers(const std::vector<int>& indices, |
| 65 | Plot1DWidget* target, |
nothing calls this directly
no test coverage detected