]> git.tdb.fi Git - r2c2.git/blobdiff - source/libr2c2/tracktype.h
Remove some unnecessary things
[r2c2.git] / source / libr2c2 / tracktype.h
index afc85215bfe0366e0e107d21371a218ea8ab282a..267d5d0f1ace2c7984d93c35d09db2ae63015ca5 100644 (file)
@@ -9,16 +9,18 @@
 
 namespace R2C2 {
 
+class TrackAppearance;
+
 class TrackType: public ObjectType
 {
 public:
        struct Endpoint
        {
                Vector pos;
-               float dir;  // Direction outwards from the endpoint
+               Angle dir;  // Direction outwards from the endpoint
                unsigned paths;
 
-               Endpoint(float, float, float, unsigned);
+               Endpoint(float, float, const Angle &, unsigned);
 
                bool has_path(unsigned p) const { return paths&(1<<p); }
                bool has_common_paths(const Endpoint &e) const { return paths&e.paths; }
@@ -26,19 +28,26 @@ public:
 
        class Loader: public Msp::DataFile::DerivedObjectLoader<TrackType, ObjectType::Loader>
        {
+       public:
+               typedef Msp::DataFile::Collection Collection;
+
        private:
+               Collection &coll;
                bool state_bits_set;
 
        public:
-               Loader(TrackType &);
+               Loader(TrackType &, Collection &);
+
+               virtual Collection &get_collection() const { return coll; }
        private:
                virtual void finish();
+               void appearance(const std::string &);
                void part();
-               void position(float, float, float);
                void state_bits(unsigned);
        };
 
 private:
+       const TrackAppearance *appearance;
        std::vector<TrackPart> parts;
        std::vector<Endpoint> endpoints;
        unsigned state_bits;
@@ -46,12 +55,15 @@ private:
        std::string object;
 
 public:
-       TrackType(const ArticleNumber &);
+       TrackType();
 
+       const TrackAppearance &get_appearance() const;
+       float get_gauge() const;
        float get_total_length() const;
        float get_path_length(int) const;
        unsigned get_paths() const;
        unsigned get_n_paths() const;
+       unsigned coerce_path(unsigned, unsigned) const;
        unsigned get_state_bits() const { return state_bits; }
        bool is_turnout() const;
        bool is_dead_end() const;
@@ -60,9 +72,8 @@ public:
        const std::vector<TrackPart> &get_parts() const { return parts; }
        const std::vector<Endpoint> &get_endpoints() const { return endpoints; }
        const Endpoint &get_endpoint(unsigned) const;
-       TrackPoint get_point(unsigned, unsigned, float) const;
-       TrackPoint get_nearest_point(const Vector &) const;
-       bool collide_ray(const Vector &, const Vector &, float) const;
+       OrientedPoint get_point(unsigned, unsigned, float) const;
+       OrientedPoint get_nearest_point(const Vector &) const;
 
 private:
        void collect_endpoints();