1 #include "libr2c2/block.h"
2 #include "allocation.h"
11 Allocation3D::Allocation3D(Layout3D &l, Train &t):
15 layout.get_layout().signal_block_reserved.connect(sigc::mem_fun(this, &Allocation3D::block_reserved));
16 train.signal_advanced.connect(sigc::mem_fun(this, &Allocation3D::train_advanced));
19 void Allocation3D::set_color(const GL::Color &c)
22 for(PathMap::const_iterator i=paths.begin(); i!=paths.end(); ++i)
24 float intensity = 0.5+train.get_block_allocator().is_block_current(*i->first)*0.5;
25 for(PathList::const_iterator j=i->second.begin(); j!=i->second.end(); ++j)
26 (*j)->set_color(color*intensity);
30 void Allocation3D::block_reserved(Block &block, Train *t)
34 if(paths.count(&block))
37 PathList &bpaths = paths[&block];
38 const Block::TrackSet &tracks = block.get_tracks();
39 for(Block::TrackSet::const_iterator i=tracks.begin(); i!=tracks.end(); ++i)
41 Path3D *path = new Path3D(layout.get_3d(**i));
42 bpaths.push_back(path);
44 float intensity = 0.5+train.get_block_allocator().is_block_current(block)*0.5;
45 path->set_color(color*intensity);
46 path->set_automatic();
51 PathMap::iterator i = paths.find(&block);
55 for(PathList::iterator j=i->second.begin(); j!=i->second.end(); ++j)
61 void Allocation3D::train_advanced(Block &block)
63 PathMap::iterator i = paths.find(&block);
67 for(PathList::iterator j=i->second.begin(); j!=i->second.end(); ++j)
68 (*j)->set_color(color);