X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fdesigner%2Fmeasure.h;h=e5f109181e379d92927f352ea06f20dd0e4a3dfa;hb=710efe5438a585b071085fc7d7ea14aebd8328fd;hp=e4f230f6b90c201de7c0222d20d4f17b47751ac2;hpb=3e9c210ddc036cd015228504cc0803c909e27f84;p=r2c2.git diff --git a/source/designer/measure.h b/source/designer/measure.h index e4f230f..e5f1091 100644 --- a/source/designer/measure.h +++ b/source/designer/measure.h @@ -1,50 +1,38 @@ -/* $Id$ - -This file is part of the MSP Märklin suite -Copyright © 2006-2008 Mikkosoft Productions, Mikko Rasa -Distributed under the GPL -*/ - #ifndef MEASURE_H_ #define MEASURE_H_ #include +#include +#include "libr2c2/geometry.h" +#include "tool.h" class Designer; -class Measure +class Measure: public Tool, public Msp::GL::Renderable { private: - enum State - { - NONE, - STARTING, - ACTIVE - }; - - Designer &designer; - Marklin::Point pointer; - Marklin::Point spoint; - float sdir; + R2C2::Snap start; + bool start_pinned; float par_dist; float perp_dist; - float adiff; - State state; + R2C2::Angle adiff; + Msp::GL::Mesh mesh; public: - sigc::signal signal_done; - sigc::signal signal_changed; + Measure(Designer &, Msp::Input::Mouse &, const std::set &); + virtual ~Measure(); - Measure(Designer &); - float get_parallel_distance() const { return par_dist; } + float get_parallel_distance() const { return par_dist; } float get_perpendicular_distance() const { return perp_dist; } - float get_angle_difference() const { return adiff; } - void start(); - void button_press(int, int, float, float, unsigned); - void pointer_motion(int, int, float, float); - void render(); + const R2C2::Angle &get_angle_difference() const { return adiff; } + + virtual void button_press(unsigned); + virtual void axis_motion(unsigned, float, float); + + virtual void render(Msp::GL::Renderer &, const Msp::GL::Tag &) const; private: - void snap_to_tracks(Marklin::Point &, float &); + void update_mesh(); + void snap_to_tracks(R2C2::Snap &); }; #endif