Subversion Repositories public iLand

Rev

Rev 30 | Rev 33 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1
 
30 Werner 2
#ifndef STAMP_H
3
#define STAMP_H
4
 
32 Werner 5
#include <QtCore>
30 Werner 6
/** Stamp is the basic class for the FON field of a individual tree.
7
 
8
*/
9
class Stamp
10
{
11
public:
12
    Stamp();
13
    ~Stamp();
32 Werner 14
    Stamp(const int size) { setup(size); }
30 Werner 15
    /// get a full access pointer to internal data
16
    float *data() { return m_data; }
17
    /// get pointer to the element after the last element (iterator style)
32 Werner 18
    const float *end() const { return &m_data[m_size*m_size]; }
30 Werner 19
    /// get pointer to data item with indices x and y
20
    float *data(const int x, const int y) { return m_data + index(x,y); }
21
    /// get index (e.g. for data()[index]) for indices x and y
32 Werner 22
    int index(const int x, const int y) const { return y*m_size + x; }
23
    // loading/saving
24
    void loadFromFile(const QString &fileName);
30 Werner 25
private:
32 Werner 26
    void setup(const int size);
30 Werner 27
    float *m_data;
32 Werner 28
    int m_size;
30 Werner 29
};
30
 
31
#endif // STAMP_H