namespace R2C2 {
Axle3D::Axle3D(const Vehicle3D &v, unsigned a):
- GL::ObjectInstance(*v.get_type().get_axle_object(a)),
+ GL::ObjectInstance(*v.get_type().get_fixed_axle_object(a)),
vehicle(v.get_vehicle()),
bogie(0),
- axle(vehicle.get_axle(a))
+ axle(vehicle.get_fixed_axle(a))
{ }
Axle3D::Axle3D(const Vehicle3D &v, unsigned b, unsigned a):
vehicle(v),
type(layout.get_catalogue().get_vehicle(vehicle.get_type()))
{
- unsigned n_axles = vehicle.get_type().get_axles().size();
+ unsigned n_axles = vehicle.get_type().get_fixed_axles().size();
for(unsigned i=0; i<n_axles; ++i)
- if(type.get_axle_object(i))
+ if(type.get_fixed_axle_object(i))
{
Axle3D *a = new Axle3D(*this, i);
axles.push_back(a);
/* $Id$
This file is part of R²C²
-Copyright © 2010 Mikkosoft Productions, Mikko Rasa
+Copyright © 2010-2011 Mikkosoft Productions, Mikko Rasa
Distributed under the GPL
*/
{
body_object = get_object(type.get_object());
- const vector<VehicleType::Axle> &axles = type.get_axles();
+ const vector<VehicleType::Axle> &axles = type.get_fixed_axles();
for(vector<VehicleType::Axle>::const_iterator i=axles.begin(); i!=axles.end(); ++i)
axle_objects[0].push_back(get_object(i->object));
delete i->second;
}
-const GL::Object *VehicleType3D::get_axle_object(unsigned i) const
+const GL::Object *VehicleType3D::get_fixed_axle_object(unsigned i) const
{
if(i>=axle_objects[0].size())
throw InvalidParameterValue("Axle index out of range");
/* $Id$
This file is part of R²C²
-Copyright © 2010 Mikkosoft Productions, Mikko Rasa
+Copyright © 2010-2011 Mikkosoft Productions, Mikko Rasa
Distributed under the GPL
*/
~VehicleType3D();
const Msp::GL::Object *get_body_object() const { return body_object; }
- const Msp::GL::Object *get_axle_object(unsigned) const;
+ const Msp::GL::Object *get_fixed_axle_object(unsigned) const;
const Msp::GL::Object *get_bogie_object(unsigned) const;
const Msp::GL::Object *get_bogie_axle_object(unsigned, unsigned) const;
const Msp::GL::Object *get_rod_object(unsigned) const;
front_sensor(0),
back_sensor(0)
{
- axles.assign(type.get_axles().begin(), type.get_axles().end());
+ axles.assign(type.get_fixed_axles().begin(), type.get_fixed_axles().end());
bogies.assign(type.get_bogies().begin(), type.get_bogies().end());
rods.assign(type.get_rods().begin(), type.get_rods().end());
propagate_position();
}
+const Vehicle::Axle &Vehicle::get_fixed_axle(unsigned i) const
+{
+ if(i>=axles.size())
+ throw InvalidParameterValue("Axle index out of range");
+ return axles[i];
+}
+
const Vehicle::Bogie &Vehicle::get_bogie(unsigned i) const
{
if(i>=bogies.size())
return bogies[i];
}
-const Vehicle::Axle &Vehicle::get_axle(unsigned i) const
-{
- if(i>=axles.size())
- throw InvalidParameterValue("Axle index out of range");
- return axles[i];
-}
-
const Vehicle::Axle &Vehicle::get_bogie_axle(unsigned i, unsigned j) const
{
if(i>=bogies.size())
i->position = i->type->pivot_point;
else if(i->type->pivot==VehicleType::Rod::AXLE)
{
- const Axle &axle = get_axle(i->type->pivot_index);
+ const Axle &axle = get_fixed_axle(i->type->pivot_index);
float c = cos(axle.angle);
float s = sin(axle.angle);
const Vector &pp = i->type->pivot_point;
/* $Id$
This file is part of R²C²
-Copyright © 2010 Mikkosoft Productions, Mikko Rasa
+Copyright © 2010-2011 Mikkosoft Productions, Mikko Rasa
Distributed under the GPL
*/
float get_offset() const { return track_pos.offs; }
const Vector &get_position() const { return position; }
float get_direction() const { return direction; }
- const Axle &get_axle(unsigned) const;
+ const Axle &get_fixed_axle(unsigned) const;
const Bogie &get_bogie(unsigned) const;
const Axle &get_bogie_axle(unsigned, unsigned) const;
const Rod &get_rod(unsigned) const;
/* $Id$
This file is part of R²C²
-Copyright © 2010 Mikkosoft Productions, Mikko Rasa
+Copyright © 2010-2011 Mikkosoft Productions, Mikko Rasa
Distributed under the GPL
*/
return (--functions.end())->first;
}
-const VehicleType::Axle &VehicleType::get_axle(unsigned i) const
+const VehicleType::Axle &VehicleType::get_fixed_axle(unsigned i) const
{
if(i>=axles.size())
throw InvalidParameterValue("Axle index out of range");
/* $Id$
This file is part of R²C²
-Copyright © 2010 Mikkosoft Productions, Mikko Rasa
+Copyright © 2010-2011 Mikkosoft Productions, Mikko Rasa
Distributed under the GPL
*/
float get_length() const { return length; }
float get_width() const { return width; }
float get_height() const { return height; }
- const AxleArray &get_axles() const { return axles; }
- const Axle &get_axle(unsigned) const;
+ const AxleArray &get_fixed_axles() const { return axles; }
+ const Axle &get_fixed_axle(unsigned) const;
const BogieArray &get_bogies() const { return bogies; }
const Bogie &get_bogie(unsigned) const;
const Axle &get_bogie_axle(unsigned, unsigned) const;