Follow-up of c791ba776f -> Estimated times for color print layed-out as 'time for color (remaining time at color start)'

This commit is contained in:
Enrico Turri 2019-08-03 08:51:03 +02:00
parent eaccd73756
commit 77df54947b
2 changed files with 20 additions and 19 deletions

View File

@ -694,38 +694,39 @@ namespace Slic3r {
return m_color_times;
}
std::vector<std::string> GCodeTimeEstimator::get_color_times_dhms(bool include_absolute) const
std::vector<std::string> GCodeTimeEstimator::get_color_times_dhms(bool include_remaining) const
{
std::vector<std::string> ret;
float total_time = 0.0f;
for (float t : m_color_times)
{
total_time += t;
std::string time = "";
if (include_absolute)
time += _get_time_dhms(total_time) + " (";
time += _get_time_dhms(t);
if (include_absolute)
std::string time = _get_time_dhms(t);
if (include_remaining)
{
time += " (";
time += _get_time_dhms(m_time - total_time);
time += ")";
}
total_time += t;
ret.push_back(time);
}
return ret;
}
std::vector<std::string> GCodeTimeEstimator::get_color_times_minutes(bool include_absolute) const
std::vector<std::string> GCodeTimeEstimator::get_color_times_minutes(bool include_remaining) const
{
std::vector<std::string> ret;
float total_time = 0.0f;
for (float t : m_color_times)
{
total_time += t;
std::string time = "";
if (include_absolute)
time += _get_time_minutes(total_time) + " (";
time += _get_time_minutes(t);
if (include_absolute)
std::string time = _get_time_minutes(t);
if (include_remaining)
{
time += " (";
time += _get_time_minutes(m_time - total_time);
time += ")";
ret.push_back(time);
}
total_time += t;
}
return ret;
}

View File

@ -350,12 +350,12 @@ namespace Slic3r {
std::vector<float> get_color_times() const;
// Returns the estimated time, in format DDd HHh MMm SSs, for each color
// If include_absolute==true the strings will be formatted as: "absolute time (relative time)"
std::vector<std::string> get_color_times_dhms(bool include_absolute) const;
// If include_remaining==true the strings will be formatted as: "time for color (remaining time at color start)"
std::vector<std::string> get_color_times_dhms(bool include_remaining) const;
// Returns the estimated time, in minutes (integer), for each color
// If include_absolute==true the strings will be formatted as: "absolute time (relative time)"
std::vector<std::string> get_color_times_minutes(bool include_absolute) const;
// If include_remaining==true the strings will be formatted as: "time for color (remaining time at color start)"
std::vector<std::string> get_color_times_minutes(bool include_remaining) const;
// Return an estimate of the memory consumed by the time estimator.
size_t memory_used() const;