root(ui_res, &window, &keyboard, &mouse),
base_object(0),
cur_route(0),
cur_zone(0),
mode(TOOL),
sel_wrap(selection),
root(ui_res, &window, &keyboard, &mouse),
base_object(0),
cur_route(0),
cur_zone(0),
mode(TOOL),
sel_wrap(selection),
{
window.set_title("Railway Designer");
window.signal_close.connect(sigc::bind(sigc::mem_fun(this, &Designer::exit), 0));
// Setup catalogue and layout
{
window.set_title("Railway Designer");
window.signal_close.connect(sigc::bind(sigc::mem_fun(this, &Designer::exit), 0));
// Setup catalogue and layout
const GL::Vector3 &cpos = view.get_camera().get_position();
GL::Vector4 cray = view.get_camera().unproject(GL::Vector4(pointer.x, pointer.y, 0, 0));
const GL::Vector3 &cpos = view.get_camera().get_position();
GL::Vector4 cray = view.get_camera().unproject(GL::Vector4(pointer.x, pointer.y, 0, 0));
overlay->add_graphic(obj3d, "trackcircuit");
overlay->set_label(obj3d, lexical_cast<string>(saddr));
}
overlay->add_graphic(obj3d, "trackcircuit");
overlay->set_label(obj3d, lexical_cast<string>(saddr));
}
if(Object *obj = pick_object(Vector(x*2.0f/rgeom.w-1.0f, y*2.0f/rgeom.h-1.0f, 0)))
{
const ObjectType &otype = obj->get_type();
if(Object *obj = pick_object(Vector(x*2.0f/rgeom.w-1.0f, y*2.0f/rgeom.h-1.0f, 0)))
{
const ObjectType &otype = obj->get_type();
if(Track *track = dynamic_cast<Track *>(obj))
{
if(mode!=CATALOGUE && abs(track->get_tilt()).radians()>1e-4)
info += format(" (slope %.1f%%)", abs(tan(track->get_tilt())*100));
if(Track *track = dynamic_cast<Track *>(obj))
{
if(mode!=CATALOGUE && abs(track->get_tilt()).radians()>1e-4)
info += format(" (slope %.1f%%)", abs(tan(track->get_tilt())*100));
info += format(" (turnout %d)", track->get_turnout_address());
else if(track->get_sensor_address())
info += format(" (sensor %d)", track->get_sensor_address());
}
info += format(" (turnout %d)", track->get_turnout_address());
else if(track->get_sensor_address())
info += format(" (sensor %d)", track->get_sensor_address());
}
Track3D &t3d = layout_3d->get_3d(**i);
Path3D *path = new Path3D(t3d);
path->set_color(GL::Color(0.5, 0.8, 1.0));
Track3D &t3d = layout_3d->get_3d(**i);
Path3D *path = new Path3D(t3d);
path->set_color(GL::Color(0.5, 0.8, 1.0));
- if(unsigned taddr = (*i)->get_turnout_address())
- path->set_path(route.get_turnout(taddr));
+ if((*i)->get_type().is_turnout())
+ path->set_path(route.get_turnout((*i)->get_turnout_address()));
+ highlight_paths.push_back(path);
Track3D &t3d = layout_3d->get_3d(**i);
Path3D *path = new Path3D(t3d);
path->set_color(GL::Color(0.8, 1.0, 0.5));
Track3D &t3d = layout_3d->get_3d(**i);
Path3D *path = new Path3D(t3d);
path->set_color(GL::Color(0.8, 1.0, 0.5));