Example #1
0
void
TaskPointRenderer::DrawOrdered(const OrderedTaskPoint &tp, Layer layer)
{
  switch (layer) {
  case LAYER_OZ_SHADE:
    if (tp.boundingbox_overlaps(bb_screen))
      // draw shaded part of observation zone
      DrawOZBackground(canvas, tp);

    break;

  case LAYER_LEG:
    if (index > 0)
      DrawTaskLine(last_point, tp.GetLocationRemaining());

    last_point = tp.GetLocationRemaining();

    break;

  case LAYER_OZ_OUTLINE:
    if (tp.boundingbox_overlaps(bb_screen))
      DrawOZForeground(tp);

    break;

  case LAYER_SYMBOLS:
    return;
  }
}
Example #2
0
bool
OrderedTask::check_transition_point(OrderedTaskPoint& point,
                                    const AircraftState &state, 
                                    const AircraftState &state_last,
                                    const FlatBoundingBox& bb_now,
                                    const FlatBoundingBox& bb_last,
                                    bool &transition_enter,
                                    bool &transition_exit,
                                    bool &last_started,
                                    const bool is_start)
{
  const bool nearby = point.boundingbox_overlaps(bb_now) || point.boundingbox_overlaps(bb_last);

  if (nearby && point.TransitionEnter(state, state_last)) {
    transition_enter = true;

    if (task_events != NULL)
      task_events->EnterTransition(point);
  }
  
  if (nearby && point.TransitionExit(state, state_last, task_projection)) {
    transition_exit = true;

    if (task_events != NULL)
      task_events->ExitTransition(point);
    
    // detect restart
    if (is_start && last_started)
      last_started = false;
  }
  
  if (is_start) 
    update_start_transition(state, point);
  
  return nearby ? point.UpdateSampleNear(state, task_events, task_projection) :
                  point.UpdateSampleFar(state, task_events, task_projection);
}