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 &);
35 class Loader: public Msp::DataFile::ObjectLoader<Axle>
41 void wheel_diameter(float);
57 class Loader: public Msp::DataFile::ObjectLoader<Bogie>
63 Loader(VehicleType &, Bogie &);
72 std::vector<Axle *> axles;
96 class Loader: public Msp::DataFile::ObjectLoader<Rod>
99 const std::map<std::string, unsigned> &tags;
103 Loader(Rod &, const std::map<std::string, unsigned> &);
104 const std::string &get_tag() const { return tag; }
106 void connect(const std::string &, float, float, float, float);
109 void pivot_axle(unsigned);
110 void pivot_bogie_axle(unsigned, unsigned);
111 void pivot_rod(const std::string &);
112 void position(float, float, float);
113 void set_tag(const std::string &);
117 unsigned pivot_index;
118 unsigned pivot_index2;
122 Vector connect_point;
123 Vector connect_offset;
130 typedef std::vector<Axle> AxleArray;
131 typedef std::vector<Bogie> BogieArray;
132 typedef std::vector<Rod> RodArray;
133 typedef std::map<unsigned, std::string> FunctionMap;
137 FunctionMap functions;
143 std::vector<Axle *> fixed_axles;
150 VehicleType(const ArticleNumber &);
152 bool is_locomotive() const { return locomotive; }
153 unsigned get_max_function() const;
154 const FunctionMap &get_functions() const { return functions; }
155 bool get_swap_direction() const { return swap_direction; }
156 float get_length() const { return length; }
157 float get_width() const { return width; }
158 float get_height() const { return height; }
159 const AxleArray &get_axles() const { return axles; }
160 const Axle &get_axle(unsigned) const;
161 const Axle &get_fixed_axle(unsigned) const;
162 const BogieArray &get_bogies() const { return bogies; }
163 const Bogie &get_bogie(unsigned) const;
164 const Axle &get_bogie_axle(unsigned, unsigned) const;
165 const RodArray &get_rods() const { return rods; }
166 const Rod &get_rod(unsigned) const;
167 float get_front_axle_offset() const;
168 float get_back_axle_offset() const;
169 const std::string &get_object() const { return object; }
170 bool get_rotate_object() const { return rotate_object; }