File: axis.h

package info (click to toggle)
neuron 8.2.6-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 34,760 kB
  • sloc: cpp: 149,571; python: 58,465; ansic: 50,329; sh: 3,510; xml: 213; pascal: 51; makefile: 35; sed: 5
file content (78 lines) | stat: -rw-r--r-- 1,830 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#ifndef axis_h
#define axis_h

#include <InterViews/observe.h>
#include <InterViews/glyph.h>

class Scene;

using namespace std;

class Axis: public Glyph, public Observer {
  public:
    Axis(Scene*, DimensionName);
    Axis(Scene*, DimensionName, Coord x1, Coord x2);
    Axis(Scene*,
         DimensionName,
         Coord x1,
         Coord x2,
         Coord pos,
         int ntic = 1,
         int nminor = 0,
         int invert = 0,
         bool number = true);
    virtual ~Axis();
    virtual void save(ostream&);
    virtual void update(Observable*);
    virtual void size(float&, float&);

  private:
    void init(Coord x1,
              Coord x2,
              Coord pos = 0.,
              int ntic = 1,
              int nminor = 0,
              int invert = 0,
              bool number = true);
    bool set_range();
    void install();
    void location();

  private:
    Scene* s_;
    Coord min_, max_;
    DimensionName d_;
    double amin_, amax_;
    int ntic_, nminor_;
    int invert_;
    bool number_;
    Coord pos_;
};

class BoxBackground: public Background {
  public:
    BoxBackground();
    virtual ~BoxBackground();

    virtual void draw(Canvas*, const Allocation&) const;
    virtual void print(Printer*, const Allocation&) const;

  private:
    void draw_help(Canvas*, const Allocation&) const;
    void tic_label(Coord x, Coord y, Coord val, float x_align, float y_align, Canvas*) const;
};

class AxisBackground: public Background {
  public:
    AxisBackground();
    virtual ~AxisBackground();

    virtual void draw(Canvas*, const Allocation&) const;
    virtual void print(Printer*, const Allocation&) const;

  private:
    void draw_help(Canvas*, const Allocation&) const;
    void tic_label(Coord x, Coord y, Coord val, float x_align, float y_align, Canvas*) const;
};

#endif