22 using namespace kome::objects;
27 #define new new( _NORMAL_BLOCK, __FILE__, __LINE__ )
28 #define malloc( s ) _malloc_dbg( s, _NORMAL_BLOCK, __FILE__, __LINE__ )
81 double minX = double();
82 double maxX = double();
108 double minX = double();
109 double maxX = double();
137 double minX = double();
138 double maxX = double();
147 for(
int i = 0; i < (int)
m_spectra.size(); i++ ) {
187 double tmpMinX = dps.
getMinX( );
188 double tmpMaxX = dps.
getMaxX( );
189 double tmpMinY = dps.
getMinY( );
190 double tmpMaxY = dps.
getMaxY( );
197 for(
unsigned int i = 0; i <
m_spectra.size(); i++ ) {
203 if( i == 0 || tmpMinX < minMz ) {
206 if( i == 0 || tmpMaxX > maxMz ) {
210 if( i == 0 || tmpMinY < minInt ) {
213 if( i == 0 || tmpMaxY > maxInt ) {
219 const double spacing = 0.2;
220 const int startIdx = std::max( 0,
roundnum( minMz / spacing ) );
221 const int endIdx = std::max( 0,
roundnum( maxMz / spacing ) );
224 const int len = endIdx - startIdx + 1;
233 static int nPrevStartIdx = 0;
234 static int nPrevEndIdx = 0;
235 static double dPrevMinMz = 0.0;
236 static double dPrevMaxMz = 0.0;
237 if ( 0 == m_nAllocLen )
239 m_bFlags =
new bool[ len ];
240 m_dInts =
new double[ len ];
241 for (
int i = 0 ; i < len ; i++ )
243 m_bFlags[ i ] =
false;
248 nPrevStartIdx = startIdx;
249 nPrevEndIdx = endIdx;
253 else if ( m_nAllocLen < len )
255 bool *bFlags =
new bool[ len ];
256 double *dInts =
new double[ len ];
258 int nStoreMin =
roundnum( dPrevMinMz / spacing );
259 nStoreMin =
CLAMP( nStoreMin, startIdx, endIdx ) - startIdx;
260 for (
int i = 0 ; i < len ; i++ )
262 if ( i >= nStoreMin && i < ( nStoreMin + m_nAllocLen ) )
264 bFlags[i] = m_bFlags[i-nStoreMin];
265 dInts[i] = m_dInts[i-nStoreMin];
296 for (
unsigned int j = 0 ; j < dps.
getLength( ) ; j++ )
298 const double x = dps.
getX( j );
299 const double y = dps.
getY( j );
301 if ( ( minX < 0.0 || x >= minX ) && ( maxX < 0.0 || x <= maxX ) )
304 idx =
CLAMP( idx, startIdx, endIdx ) - startIdx;
306 m_bFlags[ idx ] =
true;
307 if ( fabs( y ) > fabs( m_dInts[ idx ] ) )
314 for(
int i = 0; i < len; i++ ) {
315 if( m_bFlags[ i ] ) {
316 double x = spacing * ( i + startIdx );
317 double y = m_dInts[ i ];
330 for(
unsigned int i = 0; i <
m_spectra.size(); i++ ) {
334 double tmpMinX = spec->
getMinX();
335 double tmpMaxX = spec->
getMaxX();
337 if( minXX < 0.0 || tmpMinX < minXX ) {
340 if( maxXX < 0.0 || tmpMaxX > maxXX ) {
357 double intensity = 0.0;
358 for(
unsigned int i = 0; i < dps.
getLength(); i++ ) {
359 intensity += dps.
getY( i );
372 double intensity = 0.0;
373 for(
unsigned int i = 0; i < dps.
getLength(); i++ ) {
374 intensity += std::max( dps.
getY( i ), intensity );
abstraction class of two dimention coordinate data
data points data of profile management class
double getMaxX()
gets maximum x
void removeSpectrum(Spectrum *spec)
removes spectrum
double getX(const unsigned int index)
gets x coordinate
virtual double onGetMaxIntensity(const double minX, const double maxX)
This method is called by getMaxIntensity method. (override method)
virtual void onGetXYData(kome::core::XYData *const xyData, const double minX, const double maxX)
This method is called by getXYData method. (override method)
interfaces of SampleSet class
double getMinY()
gets minimum y
double getY(const unsigned int index)
gets y coordinate
int roundnum(const double v)
gets the closest integer to the argument
virtual void onGetXRange(double *minX, double *maxX)
This method is called by getMinX or getMaxX method. (override method)
std::vector< double > m_dMinX
interfaces of DataGroupNode class
double getMinX()
gets min x
std::vector< double > m_dMaxY
std::vector< double > m_dMinY
interfaces of Sample class
double getMaxX()
gets max x
virtual double onGetTotalIntensity(const double minX, const double maxX)
This method is called by getTotalIntensity method. (override method)
double getMinX()
gets minimum x
kome::core::XYData * getXYData()
gets xy data from data manager
void clearSpectra()
clears spectra
DataGroupNode * getGroup()
gets spectrum group
#define CLAMP(x, low, high)
interfaces of OverlappingSpectrum class
std::vector< Spectrum * > m_spectra
spectrum information management class
int searchSpectrum(Spectrum *spec)
searches spectrum
std::vector< double > m_dMaxX
void addPoint(const double x, const double y)
adds point
virtual ~OverlappingSpectrum()
destructor
OverlappingSpectrum()
constructor
void setGroup(DataGroupNode *group)
sets spectrum group
double getMaxY()
gets maximum y
bool getOperationFlag()
gets the operation flag value
void addSpectrum(Spectrum *spec)
adds spectrum
void setXRange(const double minX, const double maxX)
sets x range
unsigned int getLength()
gets the number of points @return the number of points