class VehicleType: public ObjectType
{
+private:
+ typedef std::map<std::string, unsigned> TagMap;
+
public:
class Loader: public Msp::DataFile::DerivedObjectLoader<VehicleType, ObjectType::Loader>
{
private:
- std::map<std::string, unsigned> rod_tags;
+ TagMap rod_tags;
public:
Loader(VehicleType &);
void function(unsigned, const std::string &);
void height(float);
void length(float);
- void rod();
+ void mirror_rods();
+ void rod(const std::string &);
void width(float);
};
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<RodConstraint>
{
- 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<Rod>
{
private:
- const std::map<std::string, unsigned> &tags;
- std::string tag;
+ TagMap &tags;
public:
- Loader(Rod &, const std::map<std::string, unsigned> &);
- 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<RodConstraint::Type>
+ 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<RodConstraint> 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<Axle> AxleArray;
typedef std::vector<Bogie> BogieArray;
typedef std::vector<Rod> RodArray;