FlipEdgeDelta.cpp

Go to the documentation of this file.
00001 
00005 /* Copyright © 2009 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 "FlipEdgeDelta.h"
00013 #include "../Track.h"
00014 #include "InsertEdgeDelta.h"
00015 
00016 namespace Document
00017 {
00018 
00019 FlipEdgeDelta::FlipEdgeDelta(std::size_t edge_name)
00020     :   edge_name(edge_name)
00021 {
00022 }
00023 
00024 FlipEdgeDelta::~FlipEdgeDelta()
00025 {
00026 }
00027 
00028 void FlipEdgeDelta::apply(Track::Track & track)
00029 {
00030     Track::Path & path = track.get_path();
00031     Track::Path::Graph & graph = path.graph;
00032     Track::Path::Graph::edge_descriptor edge_descriptor = path.get_edge_descriptor(edge_name);
00033     Track::PathEdge & edge = graph[edge_descriptor];
00034     Track::PathEdge new_edge = edge;
00035     // swap stuff over.
00036     new_edge.start = Track::PathEdgeEnd(edge_name, Track::EditAssist::EdgeStrengthHandle::EE_SOURCE);
00037     new_edge.start.gradient_strength = edge.finish.gradient_strength;
00038     new_edge.start.segment_connection_index = edge.finish.segment_connection_index;
00039     
00040     new_edge.finish = Track::PathEdgeEnd(edge_name, Track::EditAssist::EdgeStrengthHandle::EE_DESTINATION);
00041     new_edge.finish.gradient_strength = edge.start.gradient_strength;
00042     new_edge.finish.segment_connection_index = edge.start.segment_connection_index;
00043     
00044     new_edge.update(edge.get_finish_vertex_name(), edge.get_start_vertex_name(), &path);
00045     InsertEdgeDelta(new_edge).apply(track);
00046     RemoveEdgeDelta(InsertRemoveEdgeIdentifier(edge_name)).apply(track);
00047 }
00048 
00049 } // namespace Document

Get Racer at SourceForge.net. Fast, secure and Free Open Source software downloads

Generated at Mon Sep 6 00:41:11 2010 by Doxygen version 1.4.7 for Racer version svn335.