]> git.tdb.fi Git - r2c2.git/blob - source/designer/measure.h
Add Id tags and copyright notices to files
[r2c2.git] / source / designer / measure.h
1 /* $Id$
2
3 This file is part of the MSP Märklin suite
4 Copyright © 2006-2008 Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
6 */
7
8 #ifndef MEASURE_H_
9 #define MEASURE_H_
10
11 #include <sigc++/sigc++.h>
12
13 class Designer;
14
15 class Measure
16 {
17 private:
18         enum State
19         {
20                 NONE,
21                 STARTING,
22                 ACTIVE
23         };
24
25         Designer &designer;
26         Marklin::Point pointer;
27         Marklin::Point spoint;
28         float sdir;
29         float par_dist;
30         float perp_dist;
31         float adiff;
32         State state;
33
34 public:
35         sigc::signal<void> signal_done;
36         sigc::signal<void> signal_changed;
37
38         Measure(Designer &);
39         float get_parallel_distance() const      { return par_dist; }
40         float get_perpendicular_distance() const { return perp_dist; }
41         float get_angle_difference() const       { return adiff; }
42         void start();
43         void button_press(int, int, float, float, unsigned);
44         void pointer_motion(int, int, float, float);
45         void render();
46 private:
47         void snap_to_tracks(Marklin::Point &, float &);
48 };
49
50 #endif