Exemplo n.º 1
0
void
TrailRenderer::DrawTraceVector(Canvas &canvas, const Projection &projection,
                               const TracePointVector &trace)
{
  points.GrowDiscard(trace.size());

  unsigned n = 0;
  for (auto i = trace.begin(), end = trace.end(); i != end; ++i)
    points[n++] = projection.GeoToScreen(i->get_location());

  canvas.DrawPolyline(points.begin(), n);
}
Exemplo n.º 2
0
void
TrailRenderer::DrawTraceVector(Canvas &canvas, const Projection &projection,
                               const TracePointVector &trace)
{
  const unsigned n = trace.size();
  RasterPoint *p = Prepare(n);

  for (const auto &i : trace)
    *p++ = projection.GeoToScreen(i.GetLocation());

  DrawPreparedPolyline(canvas, n);
}
Exemplo n.º 3
0
bool
OLCLeague::solve(bool exhaustive)
{
  TracePointVector trace;
  trace_master.get_trace_edges(trace);

  if (trace.size()!=2) {
    return false;
  }

  if (!finish_altitude_valid(trace[0], trace[1])) {
    return false;
  }

  // solution found, so set start/finish points
  solution[0] = trace[0];
  solution[4] = trace[1];

  // scan through classic solution to find points there to add

  unsigned index_fill = 1;

  for (unsigned index_classic = 1; index_classic+1 < solution_classic.size(); ++index_classic) {
    if ((solution_classic[index_classic].time > solution[index_fill-1].time)
        &&(solution_classic[index_classic].time < trace[1].time)) {

      solution[index_fill] = solution_classic[index_classic];
      index_fill++;
      if (index_fill==4) {
        break;
      }
    }
  }

  // if insufficient points found, add repeats of previous points

  for (; index_fill<4; ++index_fill) {
    solution[index_fill] = solution[index_fill-1];
  }

  solution_found = true;

  return true;
}