00001 00005 /* Copyright © 2010 James Legg. 00006 This program is free software: you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation, either version 3 of the License, or 00009 (at your option) any later version. 00010 */ 00011 00012 #include "MoveTrackAttachmentDelta.h" 00013 #include <vector> 00014 #include <boost/shared_ptr.hpp> 00015 #include "../Track.h" 00016 00017 namespace Document 00018 { 00019 00020 TrackAttachmentPositionFinder::TrackAttachmentPositionFinder( 00021 std::size_t edge_name, std::size_t attachment_name) 00022 : m_edge_name(edge_name) 00023 , m_attachment_name(attachment_name) 00024 { 00025 } 00026 00027 void TrackAttachmentPositionFinder::read(const Track::Track & track, 00028 btVector3 & position) 00029 { 00030 const Track::PathEdge & edge(track.get_path().get_edge(m_edge_name)); 00031 const Track::TrackAttachment & attachment = edge.get_attachment(m_attachment_name); 00032 position = btVector3(attachment.get_t_position(), 00033 attachment.get_lateral_position(), 00034 attachment.get_vertical_position()); 00035 } 00036 00037 void TrackAttachmentPositionFinder::write(Track::Track & track, 00038 const btVector3 & new_position) 00039 { 00040 Track::PathEdge & edge (track.get_path().get_edge(m_edge_name)); 00041 Track::TrackAttachment attachment = edge.get_attachment(m_attachment_name); 00042 attachment.set_t_position(new_position.x()); 00043 attachment.set_lateral_position(new_position.y()); 00044 attachment.set_vertical_position(new_position.z()); 00045 edge.set_attachment(m_attachment_name, attachment); 00046 } 00047 00048 } // namespace Document
Generated at Mon Sep 6 00:41:11 2010 by Doxygen version 1.4.7 for Racer version svn335.