X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Fvehicletype.h;h=4a4d725cbab8daadabf7ec95cedf90017fa794a3;hb=81ee4fbd16b472892b67b35ea85956423a2247ed;hp=31b6992a134773c474cf1ab2868b054ccbcaca83;hpb=bc9e941447da48905295192289bc09483a678180;p=r2c2.git diff --git a/source/libr2c2/vehicletype.h b/source/libr2c2/vehicletype.h index 31b6992..4a4d725 100644 --- a/source/libr2c2/vehicletype.h +++ b/source/libr2c2/vehicletype.h @@ -9,11 +9,14 @@ namespace R2C2 { class VehicleType: public ObjectType { +private: + typedef std::map TagMap; + public: class Loader: public Msp::DataFile::DerivedObjectLoader { private: - std::map rod_tags; + TagMap rod_tags; public: Loader(VehicleType &); @@ -22,9 +25,11 @@ public: void axle(); void bogie(); void function(unsigned, const std::string &); + void gauge(float); void height(float); void length(float); - void rod(); + void mirror_rods(); + void rod(const std::string &); void width(float); }; @@ -76,57 +81,83 @@ public: Bogie(); }; - struct Rod + struct RodConstraint { - enum Anchor + enum Type + { + MOVE, + SLIDE, + ROTATE + }; + + enum Target { BODY, + BOGIE, AXLE, - BOGIE_AXLE, ROD }; - enum Limit + class Loader: public Msp::DataFile::ObjectLoader { - FIXED, - ROTATE, - SLIDE_X + private: + TagMap &tags; + + public: + Loader(RodConstraint &, TagMap &); + private: + void axis(float, float, float); + void local_position(float, float, float); + void target_axle(unsigned); + void target_position(float, float, float); + void target_rod(const std::string &); }; + Type type; + Target target; + unsigned target_index; + Vector target_position; + Vector local_position; + Vector axis; + + RodConstraint(); + }; + + struct Rod + { class Loader: public Msp::DataFile::ObjectLoader { private: - const std::map &tags; - std::string tag; + TagMap &tags; public: - Loader(Rod &, const std::map &); - const std::string &get_tag() const { return tag; } + Loader(Rod &, TagMap &); private: - void connect(const std::string &, float, float, float, float); - void limit(Limit); - void pivot_body(); - void pivot_axle(unsigned); - void pivot_bogie_axle(unsigned, unsigned); - void pivot_rod(const std::string &); - void position(float, float, float); - void set_tag(const std::string &); + template + void constraint(); + void initial_position(float, float, float); }; - Anchor pivot; - unsigned pivot_index; - unsigned pivot_index2; - Vector pivot_point; - Limit limit; - int connect_index; - Vector connect_point; - Vector connect_offset; + Vector initial_position; + std::vector constraints; std::string object; bool mirror_object; Rod(); }; + class MirrorParametersLoader: public Msp::DataFile::Loader + { + public: + std::string filter; + Angle phase_offset; + + MirrorParametersLoader(); + private: + void filt(const std::string &); + void phase_offs(float); + }; + typedef std::vector AxleArray; typedef std::vector BogieArray; typedef std::vector RodArray; @@ -136,6 +167,7 @@ private: bool locomotive; FunctionMap functions; bool swap_direction; + float gauge; float length; float width; float height; @@ -145,14 +177,16 @@ private: RodArray rods; std::string object; bool rotate_object; + float max_speed; public: - VehicleType(const ArticleNumber &); + VehicleType(const ArticleNumber & = ArticleNumber()); bool is_locomotive() const { return locomotive; } unsigned get_max_function() const; const FunctionMap &get_functions() const { return functions; } bool get_swap_direction() const { return swap_direction; } + float get_gauge() const { return gauge; } float get_length() const { return length; } float get_width() const { return width; } float get_height() const { return height; } @@ -168,6 +202,7 @@ public: float get_back_axle_offset() const; const std::string &get_object() const { return object; } bool get_rotate_object() const { return rotate_object; } + float get_maximum_speed() const { return max_speed; } }; } // namespace R2C2