]> git.tdb.fi Git - r2c2.git/blob - source/designer/measure.h
Fix some bugs in tools
[r2c2.git] / source / designer / measure.h
1 #ifndef MEASURE_H_
2 #define MEASURE_H_
3
4 #include <sigc++/sigc++.h>
5 #include <msp/gl/renderable.h>
6 #include "libr2c2/geometry.h"
7 #include "tool.h"
8
9 class Designer;
10
11 class Measure: public Tool, public Msp::GL::Renderable
12 {
13 private:
14         R2C2::Snap start;
15         bool start_pinned;
16         float par_dist;
17         float perp_dist;
18         R2C2::Angle adiff;
19         Msp::GL::Mesh mesh;
20
21 public:
22         Measure(Designer &, Msp::Input::Mouse &, const std::set<R2C2::Object *> &);
23         virtual ~Measure();
24
25         float get_parallel_distance() const { return par_dist; }
26         float get_perpendicular_distance() const { return perp_dist; }
27         const R2C2::Angle &get_angle_difference() const { return adiff; }
28
29         virtual void button_press(unsigned);
30         virtual void axis_motion(unsigned, float, float);
31
32         virtual void render(Msp::GL::Renderer &, const Msp::GL::Tag &) const;
33 private:
34         void update_mesh();
35         void snap_to_tracks(R2C2::Snap &);
36 };
37
38 #endif