X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Ftrackattachment.cpp;h=5895100706977faa44fda8492d2c4181313f2b8e;hb=c52c0e591be55cb2c7251689c69c642e3cb3601c;hp=eb2d563561c6fcf7864d00c1a8a170f943c7e624;hpb=cb4dfc37dd2cd9e02de7f022fd7f8a1fc8e5ee3c;p=r2c2.git diff --git a/source/libr2c2/trackattachment.cpp b/source/libr2c2/trackattachment.cpp index eb2d563..5895100 100644 --- a/source/libr2c2/trackattachment.cpp +++ b/source/libr2c2/trackattachment.cpp @@ -8,8 +8,7 @@ using namespace std; namespace R2C2 { TrackAttachment::TrackAttachment(Layout &l): - Object(l), - offset(0) + Object(l) { layout.signal_object_removed.connect(sigc::mem_fun(this, &TrackAttachment::object_removed)); } @@ -23,18 +22,17 @@ TrackAttachment::~TrackAttachment() float TrackAttachment::get_offset_from_endpoint(unsigned epi) const { if(epi==track.entry()) - return offset; + return track.offset(); else - return track->get_type().get_path_length(0)-offset; + return track->get_type().get_path_length(0)-track.offset(); } -void TrackAttachment::attach_to(const TrackIter &t, float o) +void TrackAttachment::attach_to(const TrackOffsetIter &t) { if(track) track->remove_attachment(*this); track = t; - offset = o; if(track) track->add_attachment(*this); @@ -74,13 +72,13 @@ void TrackAttachment::attach_to_closest(float limit) if(adiffget_type().get_path_length(0)); while(1) { - TrackPoint tp = trk->get_point(trk.entry(), offs); - float diff = dist-distance(epp, tp.pos); + OrientedPoint p = trk->get_point(trk.entry(), offs); + float diff = dist-distance(epp, p.position); if(abs(diff)