1 #ifndef LIBR2C2_VEHICLETYPE_H_
2 #define LIBR2C2_VEHICLETYPE_H_
4 #include <msp/datafile/objectloader.h>
6 #include "objecttype.h"
10 class VehicleType: public ObjectType
13 class Loader: public Msp::DataFile::DerivedObjectLoader<VehicleType, ObjectType::Loader>
16 std::map<std::string, unsigned> rod_tags;
19 Loader(VehicleType &);
21 virtual void finish();
24 void function(unsigned, const std::string &);
33 class Loader: public Msp::DataFile::ObjectLoader<Axle>
39 void wheel_diameter(float);
50 typedef std::vector<Axle> AxleArray;
54 class Loader: public Msp::DataFile::ObjectLoader<Bogie>
71 typedef std::vector<Bogie> BogieArray;
90 class Loader: public Msp::DataFile::ObjectLoader<Rod>
93 const std::map<std::string, unsigned> &tags;
97 Loader(Rod &, const std::map<std::string, unsigned> &);
98 const std::string &get_tag() const { return tag; }
100 void connect(const std::string &, float, float, float, float);
103 void pivot_axle(unsigned);
104 void pivot_bogie_axle(unsigned, unsigned);
105 void pivot_rod(const std::string &);
106 void position(float, float, float);
107 void set_tag(const std::string &);
111 unsigned pivot_index;
112 unsigned pivot_index2;
116 Vector connect_point;
117 Vector connect_offset;
124 typedef std::vector<Rod> RodArray;
126 typedef std::map<unsigned, std::string> FunctionMap;
130 FunctionMap functions;
142 VehicleType(const ArticleNumber &);
144 bool is_locomotive() const { return locomotive; }
145 unsigned get_max_function() const;
146 const FunctionMap &get_functions() const { return functions; }
147 bool get_swap_direction() const { return swap_direction; }
148 float get_length() const { return length; }
149 float get_width() const { return width; }
150 float get_height() const { return height; }
151 const AxleArray &get_fixed_axles() const { return axles; }
152 const Axle &get_fixed_axle(unsigned) const;
153 const BogieArray &get_bogies() const { return bogies; }
154 const Bogie &get_bogie(unsigned) const;
155 const Axle &get_bogie_axle(unsigned, unsigned) const;
156 const RodArray &get_rods() const { return rods; }
157 const Rod &get_rod(unsigned) const;
158 float get_front_axle_offset() const;
159 float get_back_axle_offset() const;
160 const std::string &get_object() const { return object; }
161 bool get_rotate_object() const { return rotate_object; }