Beispiel #1
0
bool
Trace::optimise_if_old()
{
  assert(cached_size == delta_list.size());
  assert(cached_size == chronological_list.Count());

  if (size() >= m_max_points) {
    // first remove points outside max time range
    bool updated = erase_earlier_than(get_min_time());

    if (size() >= m_opt_points)
      // if still too big, remove points based on line simplification
      updated |= erase_delta(m_opt_points, no_thin_time);

    if (!updated)
      return false;

  } else if (size() * 2 == m_max_points) {
    // half size, appropriate time to remove old points
    if (!erase_earlier_than(get_min_time()))
      return false;

  } else
    return false;

  m_average_delta_distance = calc_average_delta_distance(no_thin_time);
  m_average_delta_time = calc_average_delta_time(no_thin_time);

  return true;
}
Beispiel #2
0
void
Trace::Thin()
{
  assert(cached_size == delta_list.size());
  assert(cached_size == chronological_list.Count());
  assert(size() == m_max_points);

  Thin2();

  assert(size() < m_max_points);

  m_average_delta_distance = calc_average_delta_distance(no_thin_time);
  m_average_delta_time = calc_average_delta_time(no_thin_time);

  ++modify_serial;
}