Mass++ Common Libraries v2.7.5
 All Classes Namespaces Files Functions Variables Enumerations Macros
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
kome::core::PointArray Class Reference

the array of point class More...

#include <PointArray.h>

Inheritance diagram for kome::core::PointArray:
Inheritance graph
[legend]
Collaboration diagram for kome::core::PointArray:
Collaboration graph
[legend]

Public Member Functions

 PointArray ()
 constructor
 
virtual ~PointArray ()
 destructor
 
void sortByX (const bool desc)
 sorts peaks by x More...
 
void sortByY (const bool desc)
 sorts peaks by y More...
 
- Public Member Functions inherited from kome::core::XYData
 XYData ()
 constructor
 
virtual ~XYData ()
 destructor
 
double getMinX ()
 gets minimum x More...
 
double getMaxX ()
 gets maximum x More...
 
double getMinY ()
 gets minimum y More...
 
double getMaxY ()
 gets maximum y More...
 
void clearPoints ()
 clear all data points
 
void addPoint (const double x, const double y)
 adds point More...
 
void insertPoint (const unsigned int index, const double x, const double y)
 insertts point More...
 
void updatePoint (const unsigned int index, const double x, const double y)
 updates points More...
 
void deletePoint (const unsigned int index)
 delete point More...
 
unsigned int getLength ()
 gets the number of points @return the number of points
 
double getX (const unsigned int index)
 gets x coordinate More...
 
double getY (const unsigned int index)
 gets y coordinate More...
 
void reserve (const unsigned int num)
 reserves enough contiguous memory of array More...
 
unsigned long getVersion ()
 gets the version More...
 
int searchIndex (const double x)
 searches index of specified x value. More...
 
int getNearestIndex (const double x)
 gets nearest index More...
 
void filter (const double absY=0.0, const double relY=0.0)
 executes filter More...
 
void getPoints (std::vector< Point< double > > &points, const bool ySort, const bool desc)
 gets points array More...
 
bool importData (boost::function< int(void *, int) > readFun)
 imports data More...
 
bool exportData (boost::function< int(void *, int) > writeFun)
 exports data More...
 

Protected Member Functions

virtual void onClearPoints ()
 This method is called by clearPoints method. (override method)
 
virtual void onAddPoint (const double x, const double y)
 This method is called by addPoint method. (override method) More...
 
virtual void onInsertPoint (const unsigned int index, const double x, const double y)
 This method is called by insertPoint method. (override method) More...
 
virtual void onDeletePoint (const unsigned int index)
 This method is called by deletePoint method. (override method) More...
 
virtual unsigned int onGetLength ()
 this method is called by getLength method (override method) More...
 
virtual double onGetX (const unsigned int index)
 This method is called by getX method. (override method) More...
 
virtual double onGetY (const unsigned int index)
 This method is called by getY method. (override method) More...
 
virtual void onReserve (const unsigned int num)
 This method is called by reserve method. (override method) More...
 
- Protected Member Functions inherited from kome::core::XYData
void updateRange ()
 updates range
 
virtual bool onLoadData (boost::function< int(void *, int) > readFun)
 loads data from file More...
 
virtual bool onSaveData (boost::function< int(void *, int) > writeFun)
 saves data to file More...
 

Protected Attributes

std::vector< Point< double > > m_points
 
- Protected Attributes inherited from kome::core::XYData
bool m_updated
 
double m_minX
 
double m_maxX
 
double m_minY
 
double m_maxY
 
unsigned long m_version
 

Additional Inherited Members

- Static Protected Attributes inherited from kome::core::XYData
static unsigned long m_currentVersion = 0
 version More...
 

Detailed Description

the array of point class

Definition at line 29 of file PointArray.h.

Member Function Documentation

void kome::core::PointArray::onAddPoint ( const double  x,
const double  y 
)
protectedvirtual

This method is called by addPoint method. (override method)

Parameters
[in]xx coordinate of point to be added
[in]yy coordinate of point to be added

Implements kome::core::XYData.

Definition at line 71 of file PointArray.cpp.

71  {
72  Point< double > pt( x, y );
73  m_points.push_back( pt );
74 }
std::vector< Point< double > > m_points
Definition: PointArray.h:45
void kome::core::PointArray::onDeletePoint ( const unsigned int  index)
protectedvirtual

This method is called by deletePoint method. (override method)

Parameters
[in]indexpoint index

Implements kome::core::XYData.

Definition at line 93 of file PointArray.cpp.

93  {
94  // check the parameter
95  if( index >= m_points.size() ) {
96  return;
97  }
98 
99  // delete
100  std::vector< Point< double > >::iterator it = m_points.begin() + index;
101  m_points.erase( it );
102 }
std::vector< Point< double > > m_points
Definition: PointArray.h:45
unsigned int kome::core::PointArray::onGetLength ( )
protectedvirtual

this method is called by getLength method (override method)

Returns
the number of points

Implements kome::core::XYData.

Definition at line 105 of file PointArray.cpp.

105  {
106  return m_points.size();
107 }
std::vector< Point< double > > m_points
Definition: PointArray.h:45
double kome::core::PointArray::onGetX ( const unsigned int  index)
protectedvirtual

This method is called by getX method. (override method)

Parameters
[in]indexthe index of point
Returns
x coordinate

Implements kome::core::XYData.

Definition at line 110 of file PointArray.cpp.

110  {
111  return m_points[ index ].px;
112 }
std::vector< Point< double > > m_points
Definition: PointArray.h:45
double kome::core::PointArray::onGetY ( const unsigned int  index)
protectedvirtual

This method is called by getY method. (override method)

Parameters
[in]indexthe index of point
Returns
y coordiante

Implements kome::core::XYData.

Definition at line 115 of file PointArray.cpp.

115  {
116  return m_points[ index ].py;
117 }
std::vector< Point< double > > m_points
Definition: PointArray.h:45
void kome::core::PointArray::onInsertPoint ( const unsigned int  index,
const double  x,
const double  y 
)
protectedvirtual

This method is called by insertPoint method. (override method)

Parameters
[in]indexinsert position
[in]xx coordinate of point
[in]yy coordinate of point

Implements kome::core::XYData.

Definition at line 77 of file PointArray.cpp.

77  {
78  // check the parameter
79  if( index >= m_points.size() ) {
80  onAddPoint( x, y );
81  return;
82  }
83 
84  // position
85  std::vector< Point< double > >::iterator it = m_points.begin() + index;
86 
87  // insert
88  Point< double > pt( x, y );
89  m_points.insert( it, pt );
90 }
std::vector< Point< double > > m_points
Definition: PointArray.h:45
virtual void onAddPoint(const double x, const double y)
This method is called by addPoint method. (override method)
Definition: PointArray.cpp:71

Here is the call graph for this function:

void kome::core::PointArray::onReserve ( const unsigned int  num)
protectedvirtual

This method is called by reserve method. (override method)

Parameters
[in]numof points to be reserved

Implements kome::core::XYData.

Definition at line 120 of file PointArray.cpp.

120  {
121  if( num > 0 ) {
122  m_points.reserve( num );
123  }
124 }
std::vector< Point< double > > m_points
Definition: PointArray.h:45
void kome::core::PointArray::sortByX ( const bool  desc)

sorts peaks by x

Parameters
[in]descdescending order flag

Definition at line 36 of file PointArray.cpp.

36  {
37  // check the array size
38  if( m_points.size() <= 1 ) {
39  return;
40  }
41 
42  // sort
43  std::sort(
44  m_points.begin(),
45  m_points.end(),
47  );
48 }
std::vector< Point< double > > m_points
Definition: PointArray.h:45
2 dimensional point information management class
Definition: Point.h:21
void kome::core::PointArray::sortByY ( const bool  desc)

sorts peaks by y

Parameters
[in]descdescending order flag

Definition at line 51 of file PointArray.cpp.

51  {
52  // check the array size
53  if( m_points.size() <= 1 ) {
54  return;
55  }
56 
57  // sort
58  std::sort(
59  m_points.begin(),
60  m_points.end(),
62  );
63 }
std::vector< Point< double > > m_points
Definition: PointArray.h:45
2 dimensional point information management class
Definition: Point.h:21

Member Data Documentation

std::vector< Point< double > > kome::core::PointArray::m_points
protected

the array of point

Definition at line 45 of file PointArray.h.


The documentation for this class was generated from the following files: