]> git.tdb.fi Git - r2c2.git/blobdiff - source/designer/extendtool.h
Don't crash if a train has no router
[r2c2.git] / source / designer / extendtool.h
index 979c9205ef7038ba907ef60498c74000b5700de1..866d258a68e6e4f72b6ac5b1c99e187e2b909b82 100644 (file)
@@ -1,28 +1,31 @@
 #ifndef EXTENDTOOL_H_
 #define EXTENDTOOL_H_
 
+#include <map>
 #include <set>
 #include <vector>
-#include "libr2c2/track.h"
+#include "libr2c2/object.h"
+#include "libr2c2/trackiter.h"
 #include "tool.h"
 
 class ExtendTool: public Tool
 {
 private:
-       std::set<R2C2::Object *> objects;
+       std::map<float, const R2C2::TrackType *> types_by_length;
+       unsigned max_preference;
+       std::vector<R2C2::TrackIter> unlinked_endpoints;
        std::vector<R2C2::Track *> extend_tracks;
-       bool accepted;
 
 public:
-       ExtendTool(Designer &, Msp::Input::Mouse &, const std::set<R2C2::Object *> &);
+       ExtendTool(Designer &, Msp::Input::Keyboard &, Msp::Input::Mouse &, const std::set<R2C2::Object *> &);
        virtual ~ExtendTool();
 
        void connect();
 
-       virtual void button_press(unsigned);
-       virtual void axis_motion(unsigned, float, float);
-
 private:
+       virtual void pointer_motion();
+       virtual void finish();
+
        std::vector<R2C2::Track *> create_straight(const R2C2::Vector &, const R2C2::Angle &, float, float);
 
 public: