Skip to content

Commit

Permalink
Bug fixes 2776386 and 2777173
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc Sturm committed Apr 21, 2009
1 parent 7cc8eac commit ae41d92
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 11 deletions.
13 changes: 10 additions & 3 deletions source/VISUAL/Spectrum1DCanvas.C
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,9 @@ namespace OpenMS

void Spectrum1DCanvas::setDrawMode(DrawModes mode)
{
//no layers
if (layers_.size()==0) return;

if (draw_modes_[current_layer_]!=mode)
{
draw_modes_[current_layer_] = mode;
Expand All @@ -650,6 +653,9 @@ namespace OpenMS

Spectrum1DCanvas::DrawModes Spectrum1DCanvas::getDrawMode() const
{
//no layers
if (layers_.size()==0) return DM_PEAKS;

return draw_modes_[current_layer_];
}

Expand Down Expand Up @@ -1087,11 +1093,12 @@ namespace OpenMS
{
if (intensity_mode_ == IM_SNAP)
{
double local_max = -numeric_limits<double>::max();
DoubleReal local_max = -numeric_limits<double>::max();
for (Size i=0; i<getLayerCount();++i)
{
SpectrumIteratorType tmp = max_element(getLayer_(i).getCurrentSpectrum().MZBegin(visible_area_.minX()), getLayer_(i).getCurrentSpectrum().MZEnd(visible_area_.maxX()), PeakType::IntensityLess());
if (tmp->getIntensity() > local_max)
SpectrumType& spectrum = getLayer_(i).getCurrentSpectrum();
SpectrumIteratorType tmp = max_element(spectrum.MZBegin(visible_area_.minX()), spectrum.MZEnd(visible_area_.maxX()), PeakType::IntensityLess());
if (tmp != spectrum.end() && tmp->getIntensity() > local_max)
{
local_max = tmp->getIntensity();
}
Expand Down
38 changes: 30 additions & 8 deletions source/VISUAL/Spectrum2DWidget.C
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,21 @@ namespace OpenMS
{
projection_horz_->showLegend(false);
projection_horz_->canvas()->setIntensityMode(SpectrumCanvas::IM_PERCENTAGE);
projection_horz_->canvas()->removeLayer(0);
ExperimentType tmp = exp;
projection_horz_->canvas()->addLayer(tmp);
projection_horz_->canvas()->setDrawMode(mode);
if (!projectionsVisible() || projection_horz_->canvas()->getLayerCount()==0) //set draw mode
{
projection_horz_->canvas()->removeLayer(0);
ExperimentType tmp(exp); //we need a copy to swap the content into the canvas
projection_horz_->canvas()->addLayer(tmp);
projection_horz_->canvas()->setDrawMode(mode);
}
else //keep draw mode
{
Spectrum1DCanvas::DrawModes previous_mode = projection_horz_->canvas()->getDrawMode();
projection_horz_->canvas()->removeLayer(0);
ExperimentType tmp(exp); //we need a copy to swap the content into the canvas
projection_horz_->canvas()->addLayer(tmp);
projection_horz_->canvas()->setDrawMode(previous_mode);
}
grid_->setColumnStretch(3,2);
projection_horz_->show();
projection_box_->show();
Expand All @@ -297,10 +308,21 @@ namespace OpenMS
projection_vert_->canvas()->mzToXAxis(false);
projection_vert_->showLegend(false);
projection_vert_->canvas()->setIntensityMode(SpectrumCanvas::IM_PERCENTAGE);
projection_vert_->canvas()->removeLayer(0);
ExperimentType tmp = exp;
projection_vert_->canvas()->addLayer(tmp);
projection_vert_->canvas()->setDrawMode(mode);
if (!projectionsVisible() || projection_vert_->canvas()->getLayerCount()==0) //set draw mode
{
projection_vert_->canvas()->removeLayer(0);
ExperimentType tmp(exp); //we need a copy to swap the content into the canvas
projection_vert_->canvas()->addLayer(tmp);
projection_vert_->canvas()->setDrawMode(mode);
}
else //keep draw mode
{
Spectrum1DCanvas::DrawModes previous_mode = projection_vert_->canvas()->getDrawMode();
projection_vert_->canvas()->removeLayer(0);
ExperimentType tmp(exp); //we need a copy to swap the content into the canvas
projection_vert_->canvas()->addLayer(tmp);
projection_vert_->canvas()->setDrawMode(previous_mode);
}
grid_->setRowStretch(0,2);
projection_vert_->show();
projection_box_->show();
Expand Down

0 comments on commit ae41d92

Please sign in to comment.