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

Last change on this file since 4612 was 3502, checked in by ldelgass, 11 years ago

Add basic VTK structured points reader to nanovis, update copyright dates.

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