cat_view->view_all(true);
main_view->view_all();
- const set<Track *> &tracks = layout->get_all<Track>();
- for(set<Track *>::const_iterator i=tracks.begin(); i!=tracks.end(); ++i)
- update_track_icon(layout_3d->get_3d(**i));
+ const set<Object *> &objects = layout->get_all<Object>();
+ for(set<Object *>::const_iterator i=objects.begin(); i!=objects.end(); ++i)
+ update_object_icon(**i);
}
Designer::~Designer()
if(*j!=*i)
(*i)->snap_to(**j, true);
- update_track_icon(layout_3d->get_3d(**i));
+ update_object_icon(**i);
}
}
else if(key==Msp::Input::KEY_F)
return view.get_layout().get_layout().pick<Object>(Ray(cpos, Vector(cray)));
}
-void Designer::update_track_icon(Track3D &track)
+void Designer::update_object_icon(Object &obj)
{
- overlay->clear(track);
+ Object3D &obj3d = layout_3d->get_3d(obj);
+ overlay->clear(obj3d);
- if(track.get_track().get_flex())
- overlay->add_graphic(track, "flex");
+ if(Track *track = dynamic_cast<Track *>(&obj))
+ {
+ if(track->get_flex())
+ overlay->add_graphic(obj3d, "flex");
- if(unsigned saddr = track.get_track().get_sensor_address())
+ if(unsigned saddr = track->get_sensor_address())
+ {
+ overlay->add_graphic(obj3d, "trackcircuit");
+ overlay->set_label(obj3d, lexical_cast<string>(saddr));
+ }
+ else if(unsigned taddr = track->get_turnout_address())
+ {
+ if(taddr<0x800)
+ {
+ overlay->add_graphic(obj3d, "turnout");
+ overlay->set_label(obj3d, lexical_cast<string>(taddr));
+ }
+ }
+ }
+ else if(Signal *signal = dynamic_cast<Signal *>(&obj))
{
- overlay->add_graphic(track, "sensor");
- overlay->set_label(track, lexical_cast<string>(saddr));
+ overlay->add_graphic(obj3d, "signal");
+ overlay->set_label(obj3d, lexical_cast<string>(signal->get_address()));
}
- else if(unsigned taddr = track.get_track().get_turnout_address())
+ else if(BeamGate *gate = dynamic_cast<BeamGate *>(&obj))
{
- if(taddr<0x800)
- {
- overlay->add_graphic(track, "turnout");
- overlay->set_label(track, lexical_cast<string>(taddr));
- }
+ overlay->add_graphic(obj3d, "beamgate");
+ overlay->set_label(obj3d, lexical_cast<string>(gate->get_address()));
}
}
void Designer::object_properties_response(int)
{
- const set<Track *> &tracks = selection.get_objects<Track>();
- for(set<Track *>::const_iterator i=tracks.begin(); i!=tracks.end(); ++i)
- update_track_icon(layout_3d->get_3d(**i));
+ const set<Object *> &objects = selection.get_objects();
+ for(set<Object *>::const_iterator i=objects.begin(); i!=objects.end(); ++i)
+ update_object_icon(**i);
}
void Designer::route_name_accept(const string &text)