MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / showSpectrumAsNew1D

Method showSpectrumAsNew1D

src/openms_gui/source/VISUAL/TVSpectraViewController.cpp:31–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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,

Callers

nothing calls this directly

Calls 15

getCurrentLayerMethod · 0.80
getActiveCanvasMethod · 0.80
getCanvasParametersMethod · 0.80
getWorkspaceMethod · 0.80
addLayerMethod · 0.80
activateSpectrumMethod · 0.80
setVisibleAreaMethod · 0.80
updateLayerBarMethod · 0.80
updateViewBarMethod · 0.80
updateFilterBarMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected