Commit ec485749 authored by Matthew Bowles's avatar Matthew Bowles
Browse files

add removePeaks method to PeaksWorkspace Re #19472

parent 3750b70e
......@@ -98,6 +98,7 @@ public:
int getNumberPeaks() const override;
std::string getConvention() const override;
void removePeak(int peakNum) override;
void removePeaks(const std::vector<Peak*>& it);
void addPeak(const Geometry::IPeak &peak) override;
/// Move a peak object into this peaks workspace
void addPeak(Peak &&peak);
......
......@@ -17,6 +17,7 @@
#include "MantidKernel/Quat.h"
#include "MantidKernel/Unit.h"
#include "MantidKernel/V3D.h"
#include <algorithm>
#include <boost/shared_ptr.hpp>
#include <cmath>
......@@ -149,6 +150,16 @@ void PeaksWorkspace::removePeak(const int peakNum) {
peaks.erase(peaks.begin() + peakNum);
}
/** Removes multiple peaks
* @param badPeaks Pointers to peaks to be removed
*/
void PeaksWorkspace::removePeaks(const std::vector<Peak*>& badPeaks) {
peaks.erase(remove_if(peaks.begin(), peaks.end(),
[&badPeaks] (const Mantid::DataObjects::Peak& peak)
{return std::find(badPeaks.begin(), badPeaks.end(), &peak) != badPeaks.end(); }),
peaks.end());
}
//---------------------------------------------------------------------------------------------
/** Add a peak to the list
* @param ipeak :: Peak object to add (copy) into this.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment