if(unlinked_endpoints.empty())
{
- done = true;
set_status("No free endpoints");
+ set_done(false);
}
const Catalogue::ObjectMap &object_types = designer.get_catalogue().get_all();
if(!ok)
{
set_status("No aligned endpoints found");
+ set_done(false);
return;
}
if(extend_tracks.empty())
{
set_status("No connection possible");
+ set_done(false);
return;
}
void ExtendTool::finish()
{
- for(vector<TrackIter>::const_iterator i=unlinked_endpoints.begin(); i!=unlinked_endpoints.end(); ++i)
- if(extend_tracks.front()->link_to(**i))
- break;
+ if(!extend_tracks.empty())
+ {
+ for(vector<TrackIter>::const_iterator i=unlinked_endpoints.begin(); i!=unlinked_endpoints.end(); ++i)
+ if(extend_tracks.front()->link_to(**i))
+ break;
+ }
}
vector<Track *> ExtendTool::create_straight(const Vector &start, const Angle &dir, float length, float limit)
void SlopeTool::even_slope(bool smooth)
{
+ if(done)
+ return;
+
float start_z = tracks.front()->get_snap_node(tracks.front().entry()).position.z;
float end_z = tracks.back()->get_snap_node(tracks.back().reverse().entry()).position.z;
set_slope(*i, cur_z, tilt);
cur_z += (*i)->get_type().get_path_length(0)*(end_z-start_z)/length;
}
+
+ set_done(true);
}
void SlopeTool::flatten()
{
+ if(done)
+ return;
+
float z = 0;
for(list<TrackIter>::iterator i=tracks.begin(); i!=tracks.end(); ++i)
{
(*i)->set_position(Vector(p.x, p.y, z));
(*i)->set_tilt(Angle::zero());
}
+
+ set_done(true);
}
void SlopeTool::set_slope(const TrackIter &track, float z, const Angle &tilt)