]> git.tdb.fi Git - r2c2.git/blobdiff - source/libr2c2/track.h
Use a dedicated exception class for route errors
[r2c2.git] / source / libr2c2 / track.h
index 82365a5ab02127ed5a0742e567bae153bf546cbd..326c2e28e3d65fe479c4ddc1c2e694a79deae5e3 100644 (file)
@@ -1,10 +1,3 @@
-/* $Id$
-
-This file is part of R²C²
-Copyright © 2006-2010  Mikkosoft Productions, Mikko Rasa
-Distributed under the GPL
-*/
-
 #ifndef LIBR2C2_TRACK_H_
 #define LIBR2C2_TRACK_H_
 
@@ -40,7 +33,7 @@ private:
        Layout &layout;
        const TrackType &type;
        Block *block;
-       Point pos;
+       Vector pos;
        float rot;
        float slope;
        bool flex;
@@ -60,11 +53,11 @@ public:
 
        void set_block(Block *);
        Block &get_block() const;
-       void set_position(const Point &);
+       void set_position(const Vector &);
        void set_rotation(float);
        void set_slope(float);
        void set_flex(bool);
-       const Point &get_position() const { return pos; }
+       const Vector &get_position() const { return pos; }
        float get_rotation() const { return rot; }
        float get_slope() const { return slope; }
        bool get_flex() const { return flex; }
@@ -78,10 +71,10 @@ public:
        unsigned get_active_path() const { return active_path; }
 
        int get_endpoint_by_link(Track &) const;
-       Point get_endpoint_position(unsigned) const;
+       Vector get_endpoint_position(unsigned) const;
        float get_endpoint_direction(unsigned) const;
        bool snap_to(Track &, bool, float = 0);
-       bool snap(Point &, float &) const;
+       bool snap(Vector &, float &) const;
        void break_link(Track &);
        void break_links();
        const std::vector<Track *> &get_links() const { return links; }
@@ -89,6 +82,8 @@ public:
        TrackPoint get_point(unsigned, unsigned, float) const;
        TrackPoint get_point(unsigned, float) const;
 
+       bool collide_ray(const Vector &, const Vector &);
+
        void save(std::list<Msp::DataFile::Statement> &) const;
 private:
        void turnout_event(unsigned, unsigned);