source: branches/1.7/src/core2/RpNode.h @ 6313

Last change on this file since 6313 was 5679, checked in by ldelgass, 9 years ago

Full merge 1.3 branch to uq branch to sync. Fixed partial subdirectory merge
by removing mergeinfo from lang/python/Rappture directory.

  • Property svn:eol-style set to native
File size: 2.3 KB
Line 
1/*
2 * ----------------------------------------------------------------------
3 *  Rappture::Node1D
4 *  Rappture::Node2D
5 *  Rappture::Node3D
6 *    This is a node in cartesian coordinate space.
7 *
8 * ======================================================================
9 *  AUTHOR:  Michael McLennan, Purdue University
10 *  Copyright (c) 2004-2012  HUBzero Foundation, LLC
11 *
12 *  See the file "license.terms" for information on usage and
13 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
14 * ======================================================================
15 */
16#ifndef RPNODE_H
17#define RPNODE_H
18
19namespace Rappture {
20
21enum Axis {
22   xaxis, yaxis, zaxis
23};
24
25class Node {
26public:
27    Node() : _id(-1) {}
28
29    virtual Node& id(int newid) { _id=newid; return *this; }
30    virtual int id() const { return _id; }
31
32    virtual int dimensionality() const = 0;
33
34    virtual ~Node() {}
35
36private:
37    int _id;  // node identifier (used for fields)
38};
39
40
41class Node1D : public Node {
42public:
43    Node1D(double x) : _x(x) {}
44
45    virtual int dimensionality() const { return 1; }
46    virtual double x() const { return _x; }
47    virtual double x(double newval) { _x = newval; return _x; }
48
49    virtual ~Node1D() {}
50
51private:
52    double _x;  // x-coordinate
53};
54
55
56class Node2D : public Node {
57public:
58    Node2D(double x, double y) : _x(x), _y(y) {}
59
60    virtual int dimensionality() const { return 2; }
61    virtual double x() const { return _x; }
62    virtual double y() const { return _y; }
63
64    virtual double x(double newval) { _x = newval; return _x; }
65    virtual double y(double newval) { _y = newval; return _y; }
66
67    virtual ~Node2D() {}
68
69private:
70    double _x;  // x-coordinate
71    double _y;  // y-coordinate
72};
73
74
75class Node3D : public Node {
76public:
77    Node3D(double x, double y, double z) : _x(x), _y(y), _z(z) {}
78
79    virtual int dimensionality() const { return 3; }
80    virtual double x() const { return _x; }
81    virtual double y() const { return _y; }
82    virtual double z() const { return _z; }
83
84    virtual double x(double newval) { _x = newval; return _x; }
85    virtual double y(double newval) { _y = newval; return _y; }
86    virtual double z(double newval) { _z = newval; return _z; }
87
88    virtual ~Node3D() {}
89
90private:
91    double _x;  // x-coordinate
92    double _y;  // y-coordinate
93    double _z;  // y-coordinate
94};
95
96} // namespace Rappture
97
98#endif /*RPNODE_H*/
Note: See TracBrowser for help on using the repository browser.