source: nanovis/branches/1.1/AxisRange.h @ 4923

Last change on this file since 4923 was 4889, checked in by ldelgass, 9 years ago

Merge r3611:3618 from trunk

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