X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Fbeamgate.cpp;h=15c2b8e05fea22587ccb0fb114441b2b805d1cc2;hb=508ee4bfcc0f8fb1373fb7af251c59c873ef896f;hp=bb382ffe89c04681dd559c52ca844621229a2109;hpb=0443ca05cbd306487131f5f5bd3b91181ae4a733;p=r2c2.git diff --git a/source/libr2c2/beamgate.cpp b/source/libr2c2/beamgate.cpp index bb382ff..15c2b8e 100644 --- a/source/libr2c2/beamgate.cpp +++ b/source/libr2c2/beamgate.cpp @@ -1,5 +1,4 @@ #include "beamgate.h" -#include "catalogue.h" #include "layout.h" using namespace std; @@ -13,17 +12,17 @@ BeamGate::BeamGate(Layout &l): { invert = true; - layout.add(*this); + TrackAttachment::layout.add(*this); } BeamGate::~BeamGate() { - layout.remove(*this); + TrackAttachment::layout.remove(*this); } BeamGate *BeamGate::clone(Layout *to_layout) const { - BeamGate *gate = new BeamGate(to_layout ? *to_layout : layout); + BeamGate *gate = new BeamGate(to_layout ? *to_layout : TrackAttachment::layout); gate->set_position(position); gate->set_rotation(rotation); return gate; @@ -50,13 +49,14 @@ void BeamGate::set_rotation(const Angle &r) void BeamGate::update_attachment() { - attach_to_closest(100*layout.get_catalogue().get_gauge()); + attach_to_closest(100); if(track) { - TrackPoint tp = track.point(); - position = tp.pos; - rotation = tp.dir; + OrientedPoint p = track.point(); + position = p.position; + rotation = p.rotation; + tilt = p.tilt; } }