-/* $Id$
-
-This file is part of R²C²
-Copyright © 2006-2010 Mikkosoft Productions, Mikko Rasa
-Distributed under the GPL
-*/
-
#include <algorithm>
#include <cmath>
-#include <msp/strings/formatter.h>
+#include <msp/strings/format.h>
#include "libr2c2/tracktype.h"
#include "designer.h"
#include "manipulator.h"
delete *i;
extend_tracks = trks;
+ map<ArticleNumber, unsigned> counts;
length = 0;
for(vector<Track *>::iterator i=extend_tracks.begin(); i!=extend_tracks.end(); ++i)
+ {
length += (*i)->get_type().get_total_length();
-
- signal_status.emit(format("Extend: %.0fmm", length*1000));
+ ++counts[(*i)->get_type().get_article_number()];
+ }
+
+ string detail;
+ for(map<ArticleNumber, unsigned>::const_iterator i=counts.begin(); i!=counts.end(); ++i)
+ {
+ if(!detail.empty())
+ detail += ", ";
+ detail += format("%dx %s", i->second, i->first);
+ }
+
+ signal_status.emit(format("Extend: %.0fmm (%s)", length*1000, detail));
}
}
}
float s = sin(dir);
for(vector<float>::iterator i=lengths.begin(); i!=lengths.end(); ++i)
{
- map<float, const TrackType *>::iterator j = types_by_length.find(*i);
- if(j==types_by_length.end())
- throw LogicError("Internal error");
-
- Track *track = new Track(designer.get_layout(), *j->second);
+ Track *track = new Track(designer.get_layout(), *get_item(types_by_length, *i));
track->set_position(pos);
track->set_rotation(dir);