*/
#include <cmath>
+#include "block.h"
#include "driver.h"
#include "layout.h"
#include "track.h"
Track::Track(Layout &l, const TrackType &t):
layout(l),
type(t),
+ block(0),
rot(0),
slope(0),
flex(false),
layout.remove_track(*this);
}
+void Track::set_block(Block *b)
+{
+ if(b && !b->has_track(*this))
+ throw InvalidParameterValue("Track is not in the Block");
+ if(!b && block && block->has_track(*this))
+ throw InvalidState("Track is still in a Block");
+
+ block = b;
+}
+
+Block &Track::get_block() const
+{
+ if(!block)
+ throw InvalidState("No Block");
+
+ return *block;
+}
+
void Track::set_position(const Point &p)
{
pos = p;