source: trunk/packages/vizservers/nanovis/AxisRange.h @ 3464

Last change on this file since 3464 was 3362, checked in by ldelgass, 11 years ago

Merge nanovis2 branch to trunk

  • Property svn:eol-style set to native
File size: 1.1 KB
Line 
1/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2#ifndef AXIS_RANGE_H
3#define AXIS_RANGE_H
4
5#include <string.h>
6
7class AxisRange
8{
9public:
10    AxisRange() :
11        _min(0.0),
12        _max(1.0),
13        _units(NULL)
14    {
15    }
16
17    ~AxisRange()
18    {
19        if (_units != NULL) {
20            delete [] _units;
21        }
22    }
23
24    void setRange(double min, double max)
25    {
26        _min = min;
27        _max = max;
28    }
29
30    double min() const
31    {
32        return _min;
33    }
34
35    void min(double min)
36    {
37        _min = min;
38    }
39
40    double max() const
41    {
42        return _max;
43    }
44
45    void max(double max)
46    {
47        _max = max;
48    }
49
50    double length() const
51    {
52        return (_max - _min);
53    }
54
55    const char *units() const
56    {
57        return _units;
58    }
59
60    void units(const char *units)
61    {
62        if (_units != NULL) {
63            delete [] _units;
64        }
65        if (units == NULL) {
66            _units = NULL;
67        } else {
68            _units = new char[strlen(units) + 1];
69            strcpy(_units, units);
70        }
71    }
72
73private:
74    double _min, _max;
75    char *_units;
76};
77
78#endif
Note: See TracBrowser for help on using the repository browser.