Line | |
---|
1 | #ifndef __RP_NODE3D_H__ |
---|
2 | #define __RP_NODE3D_H__ |
---|
3 | |
---|
4 | #include <iostream> |
---|
5 | #include <vector> |
---|
6 | #include "util.h" |
---|
7 | |
---|
8 | // |
---|
9 | // define a 3-d node (x, y, z) |
---|
10 | // |
---|
11 | class RpNode3d { |
---|
12 | public: |
---|
13 | // constructors |
---|
14 | RpNode3d() { }; |
---|
15 | |
---|
16 | RpNode3d(int id): m_id(id) |
---|
17 | { }; |
---|
18 | |
---|
19 | RpNode3d(int id, int x, int y, int z): |
---|
20 | m_id(id), |
---|
21 | m_x(x), |
---|
22 | m_y(y), |
---|
23 | m_z(z) |
---|
24 | { }; |
---|
25 | |
---|
26 | void operator=(const int* val) |
---|
27 | { m_x = val[0]; m_y = val[1]; m_z = val[2]; }; |
---|
28 | |
---|
29 | // assign value to coordinate[index] |
---|
30 | void set(int x, int y, int z) |
---|
31 | { m_x = x; m_y = y; m_z =z; }; |
---|
32 | void set(int* val) |
---|
33 | { m_x = val[0]; m_y = val[1]; m_z = val[2]; }; |
---|
34 | |
---|
35 | // get node coordinates |
---|
36 | void get(int& xval, int& yval, int& zval) |
---|
37 | { xval = m_x; yval = m_y; zval = m_z; }; |
---|
38 | void get(int* xval, int* yval, int* zval) |
---|
39 | { *xval = m_x; *yval = m_y; *zval = m_z; }; |
---|
40 | |
---|
41 | void get(int * val) { val[0] = m_x; val[1] = m_y; val[2] = m_z; }; |
---|
42 | |
---|
43 | int id() { return m_id; }; |
---|
44 | void id(int id) { m_id = id; }; |
---|
45 | |
---|
46 | char* serialize(); |
---|
47 | RP_ERROR serialize(char* buf); |
---|
48 | RP_ERROR deserialize(const char* buf); |
---|
49 | |
---|
50 | void xmlString(std::string& str); |
---|
51 | void print(); |
---|
52 | |
---|
53 | void erase() { |
---|
54 | m_id = 0; |
---|
55 | m_x = m_y = m_z = 0; |
---|
56 | }; |
---|
57 | |
---|
58 | virtual ~RpNode3d() { }; |
---|
59 | |
---|
60 | private: |
---|
61 | int m_id; |
---|
62 | int m_x; |
---|
63 | int m_y; |
---|
64 | int m_z; |
---|
65 | }; |
---|
66 | |
---|
67 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.