示例#1
0
bool
OrderedTask::CheckTransitionPoint(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.BoundingBoxOverlaps(bb_now) ||
    point.BoundingBoxOverlaps(bb_last);

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

    if (task_events != nullptr)
      task_events->EnterTransition(point);
  }

  if (nearby && point.TransitionExit(state, state_last, task_projection)) {
    transition_exit = true;

    if (task_events != nullptr)
      task_events->ExitTransition(point);

    // detect restart
    if (is_start && last_started)
      last_started = false;
  }

  if (is_start)
    UpdateStartTransition(state, point);

  return nearby
    ? point.UpdateSampleNear(state, task_projection)
    : point.UpdateSampleFar(state, task_projection);
}
示例#2
0
gcc_pure
static double
GetRadius(const OrderedTaskPoint &tp)
{
  return GetRadius(tp.GetObservationZone());
}
示例#3
0
AbstractTaskFactory::LegalPointType_t 
AbstractTaskFactory::getType(const OrderedTaskPoint &point) const
{
  const ObservationZonePoint* oz = point.get_oz();

  switch (point.GetType()) {
  case TaskPoint::START:
    switch (oz->shape) {
    case ObservationZonePoint::FAI_SECTOR:
      return START_SECTOR;

    case ObservationZonePoint::LINE:
      return START_LINE;

    case ObservationZonePoint::CYLINDER:
    case ObservationZonePoint::SECTOR:
    case ObservationZonePoint::KEYHOLE:
    case ObservationZonePoint::BGAFIXEDCOURSE:
    case ObservationZonePoint::BGAENHANCEDOPTION:
    case ObservationZonePoint::ANNULAR_SECTOR:
      return START_CYLINDER;

    case ObservationZonePoint::BGA_START:
      return START_BGA;
    }
    break;

  case TaskPoint::AAT:
    switch (oz->shape) {
    case ObservationZonePoint::SECTOR:
    case ObservationZonePoint::FAI_SECTOR:
    case ObservationZonePoint::KEYHOLE:
    case ObservationZonePoint::BGAFIXEDCOURSE:
    case ObservationZonePoint::BGAENHANCEDOPTION:
    case ObservationZonePoint::BGA_START:
    case ObservationZonePoint::LINE:
      return AAT_SEGMENT;
    case ObservationZonePoint::ANNULAR_SECTOR:
      return AAT_ANNULAR_SECTOR;
    case ObservationZonePoint::CYLINDER:
      return AAT_CYLINDER;
    }
    break;

  case TaskPoint::AST:
    switch (oz->shape) {
    case ObservationZonePoint::FAI_SECTOR:
      return FAI_SECTOR;

    case ObservationZonePoint::KEYHOLE:
      return KEYHOLE_SECTOR;

    case ObservationZonePoint::BGAFIXEDCOURSE:
      return BGAFIXEDCOURSE_SECTOR;

    case ObservationZonePoint::BGAENHANCEDOPTION:
      return BGAENHANCEDOPTION_SECTOR;

    case ObservationZonePoint::BGA_START:
    case ObservationZonePoint::CYLINDER:
    case ObservationZonePoint::SECTOR:
    case ObservationZonePoint::LINE:
    case ObservationZonePoint::ANNULAR_SECTOR:
      return AST_CYLINDER;
    }
    break;

  case TaskPoint::FINISH:
    switch (oz->shape) {
    case ObservationZonePoint::BGA_START:
    case ObservationZonePoint::FAI_SECTOR:
      return FINISH_SECTOR;

    case ObservationZonePoint::LINE:
      return FINISH_LINE;

    case ObservationZonePoint::CYLINDER:
    case ObservationZonePoint::SECTOR:
    case ObservationZonePoint::KEYHOLE:
    case ObservationZonePoint::BGAFIXEDCOURSE:
    case ObservationZonePoint::BGAENHANCEDOPTION:
    case ObservationZonePoint::ANNULAR_SECTOR:
      return FINISH_CYLINDER;
    }
    break;

  case TaskPoint::UNORDERED:
  case TaskPoint::ROUTE:
    /* obviously, when we check the type of an OrderedTaskPoint, we
       should never get type==UNORDERED or ROUTE. */
    assert(false);
    break;
  }

  // fail, should never get here
  assert(1);
  return START_LINE;
}
示例#4
0
bool test_task_aat(TaskManager& task_manager,
                   const Waypoints &waypoints)
{
    task_manager.SetFactory(TaskFactoryType::AAT);
    AbstractTaskFactory &fact = task_manager.GetFactory();
    const Waypoint *wp;

    task_report(task_manager, "# adding start\n");
    wp = waypoints.LookupId(1);
    if (wp) {
        OrderedTaskPoint *tp = fact.CreateStart(*wp);
        if (!fact.Append(*tp,false)) {
            return false;
        }
        delete tp;
    }

    task_manager.SetActiveTaskPoint(0);
    task_manager.Resume();

    task_report(task_manager, "# adding intermediate\n");
    wp = waypoints.LookupId(2);
    if (wp) {
        OrderedTaskPoint* tp = fact.CreateIntermediate(TaskPointFactoryType::AAT_CYLINDER,*wp);
        if (tp->GetObservationZone().GetShape() == ObservationZone::Shape::CYLINDER) {
            CylinderZone &cz = (CylinderZone &)tp->GetObservationZone();
            cz.SetRadius(fixed(30000.0));
        }
        if (!fact.Append(*tp,false)) {
            return false;
        }
        delete tp;
    }

    task_report(task_manager, "# adding intermediate\n");
    wp = waypoints.LookupId(3);
    if (wp) {
        OrderedTaskPoint* tp = fact.CreateIntermediate(TaskPointFactoryType::AAT_CYLINDER,*wp);
        if (tp->GetObservationZone().GetShape() == ObservationZone::Shape::CYLINDER) {
            CylinderZone &cz = (CylinderZone &)tp->GetObservationZone();
            cz.SetRadius(fixed(40000.0));
        }
        if (!fact.Append(*tp,false)) {
            return false;
        }
        delete tp;
    }

    task_report(task_manager, "# adding finish\n");
    wp = waypoints.LookupId(1);
    if (wp) {
        OrderedTaskPoint *tp = fact.CreateFinish(*wp);
        if (!fact.Append(*tp,false)) {
            return false;
        }
        delete tp;
    }

    fact.UpdateStatsGeometry();

    task_report(task_manager, "# checking task..\n");
    if (!fact.Validate()) {
        return false;
    }

    if (!task_manager.CheckOrderedTask()) {
        return false;
    }
    return true;
}
示例#5
0
static fixed
GetRadius(const OrderedTaskPoint &tp)
{
  return GetRadius(*tp.get_oz());
}
示例#6
0
static fixed
GetRadius(const OrderedTaskPoint &tp)
{
  return GetRadius(tp.GetObservationZone());
}
示例#7
0
TaskPointFactoryType 
AbstractTaskFactory::GetType(const OrderedTaskPoint &point) const
{
  const ObservationZonePoint &oz = point.GetObservationZone();

  switch (point.GetType()) {
  case TaskPointType::START:
    switch (oz.GetShape()) {
    case ObservationZone::Shape::FAI_SECTOR:
    case ObservationZone::Shape::SYMMETRIC_QUADRANT:
      return TaskPointFactoryType::START_SECTOR;

    case ObservationZone::Shape::LINE:
      return TaskPointFactoryType::START_LINE;

    case ObservationZone::Shape::CYLINDER:
    case ObservationZone::Shape::MAT_CYLINDER:
    case ObservationZone::Shape::SECTOR:
    case ObservationZone::Shape::DAEC_KEYHOLE:
    case ObservationZone::Shape::CUSTOM_KEYHOLE:
    case ObservationZone::Shape::BGAFIXEDCOURSE:
    case ObservationZone::Shape::BGAENHANCEDOPTION:
    case ObservationZone::Shape::ANNULAR_SECTOR:
      return TaskPointFactoryType::START_CYLINDER;

    case ObservationZone::Shape::BGA_START:
      return TaskPointFactoryType::START_BGA;
    }
    break;

  case TaskPointType::AAT:
    switch (oz.GetShape()) {
    case ObservationZone::Shape::SECTOR:
    case ObservationZone::Shape::FAI_SECTOR:
    case ObservationZone::Shape::SYMMETRIC_QUADRANT:
    case ObservationZone::Shape::DAEC_KEYHOLE:
    case ObservationZone::Shape::BGAFIXEDCOURSE:
    case ObservationZone::Shape::BGAENHANCEDOPTION:
    case ObservationZone::Shape::BGA_START:
    case ObservationZone::Shape::LINE:
      return TaskPointFactoryType::AAT_SEGMENT;
    case ObservationZone::Shape::ANNULAR_SECTOR:
      return TaskPointFactoryType::AAT_ANNULAR_SECTOR;
    case ObservationZone::Shape::CYLINDER:
      return TaskPointFactoryType::AAT_CYLINDER;

    case ObservationZone::Shape::CUSTOM_KEYHOLE:
      return TaskPointFactoryType::AAT_KEYHOLE;

    case ObservationZone::Shape::MAT_CYLINDER:
      return TaskPointFactoryType::MAT_CYLINDER;
    }
    break;

  case TaskPointType::AST:
    switch (oz.GetShape()) {
    case ObservationZone::Shape::FAI_SECTOR:
      return TaskPointFactoryType::FAI_SECTOR;

    case ObservationZone::Shape::DAEC_KEYHOLE:
    case ObservationZone::Shape::CUSTOM_KEYHOLE:
      return TaskPointFactoryType::KEYHOLE_SECTOR;

    case ObservationZone::Shape::BGAFIXEDCOURSE:
      return TaskPointFactoryType::BGAFIXEDCOURSE_SECTOR;

    case ObservationZone::Shape::BGAENHANCEDOPTION:
      return TaskPointFactoryType::BGAENHANCEDOPTION_SECTOR;

    case ObservationZone::Shape::BGA_START:
    case ObservationZone::Shape::CYLINDER:
    case ObservationZone::Shape::MAT_CYLINDER:
    case ObservationZone::Shape::SECTOR:
    case ObservationZone::Shape::LINE:
    case ObservationZone::Shape::ANNULAR_SECTOR:
      return TaskPointFactoryType::AST_CYLINDER;

    case ObservationZone::Shape::SYMMETRIC_QUADRANT:
      return TaskPointFactoryType::SYMMETRIC_QUADRANT;
    }
    break;

  case TaskPointType::FINISH:
    switch (oz.GetShape()) {
    case ObservationZone::Shape::BGA_START:
    case ObservationZone::Shape::FAI_SECTOR:
    case ObservationZone::Shape::SYMMETRIC_QUADRANT:
      return TaskPointFactoryType::FINISH_SECTOR;

    case ObservationZone::Shape::LINE:
      return TaskPointFactoryType::FINISH_LINE;

    case ObservationZone::Shape::CYLINDER:
    case ObservationZone::Shape::MAT_CYLINDER:
    case ObservationZone::Shape::SECTOR:
    case ObservationZone::Shape::DAEC_KEYHOLE:
    case ObservationZone::Shape::CUSTOM_KEYHOLE:
    case ObservationZone::Shape::BGAFIXEDCOURSE:
    case ObservationZone::Shape::BGAENHANCEDOPTION:
    case ObservationZone::Shape::ANNULAR_SECTOR:
      return TaskPointFactoryType::FINISH_CYLINDER;
    }
    break;

  case TaskPointType::UNORDERED:
    /* obviously, when we check the type of an OrderedTaskPoint, we
       should never get type==UNORDERED */
    gcc_unreachable();
    break;
  }

  // fail, should never get here
  gcc_unreachable();
}
示例#8
0
static void
RefreshView()
{
  wTaskView->invalidate();

  OrderedTaskPoint* tp = ordered_task->get_tp(active_index);
  if (!tp)
    return;

  Refreshing = true; // tell onChange routines not to save form!

  ShowFormControl(*wf, _T("frmOZLine"), false);
  ShowFormControl(*wf, _T("frmOZSector"), false);
  ShowFormControl(*wf, _T("frmOZCylinder"), false);

  const ObservationZonePoint &oz = *tp->get_oz();

  switch (oz.shape) {
  case ObservationZonePoint::SECTOR:
  case ObservationZonePoint::ANNULAR_SECTOR:
    ShowFormControl(*wf, _T("frmOZSector"), true);

    LoadFormProperty(*wf, _T("prpOZSectorRadius"),
                     ugDistance, ((const SectorZone &)oz).getRadius());
    LoadFormProperty(*wf, _T("prpOZSectorStartRadial"),
                     ((const SectorZone &)oz).getStartRadial().value_degrees());
    LoadFormProperty(*wf, _T("prpOZSectorFinishRadial"),
                     ((const SectorZone &)oz).getEndRadial().value_degrees());

    if (oz.shape == ObservationZonePoint::ANNULAR_SECTOR) {
      LoadFormProperty(*wf, _T("prpOZSectorInnerRadius"),
                       ugDistance, ((const AnnularSectorZone &)oz).getInnerRadius());

      ShowFormControl(*wf, _T("prpOZSectorInnerRadius"), true);
    } else
      ShowFormControl(*wf, _T("prpOZSectorInnerRadius"), false);

    break;

  case ObservationZonePoint::LINE:
    ShowFormControl(*wf, _T("frmOZLine"), true);

    LoadFormProperty(*wf, _T("prpOZLineLength"), ugDistance,
                     ((const LineSectorZone &)oz).getLength());
    break;

  case ObservationZonePoint::CYLINDER:
    ShowFormControl(*wf, _T("frmOZCylinder"), true);

    LoadFormProperty(*wf, _T("prpOZCylinderRadius"), ugDistance,
                     ((const CylinderZone &)oz).getRadius());
    break;

  default:
    break;
  }

  WndFrame* wfrm = NULL;
  wfrm = ((WndFrame*)wf->FindByName(_T("lblType")));
  if (wfrm)
    wfrm->SetCaption(OrderedTaskPointName(ordered_task->get_factory().getType(*tp)));

  SetFormControlEnabled(*wf, _T("butPrevious"), active_index > 0);
  SetFormControlEnabled(*wf, _T("butNext"),
                        active_index < (ordered_task->TaskSize() - 1));

  WndButton* wb;
  wb = (WndButton*)wf->FindByName(_T("cmdOptionalStarts"));
  assert(wb);
  wb->set_visible(active_index == 0);
  if (ordered_task->optional_start_points_size() == 0)
    wb->SetCaption(_("Enable Alternate Starts"));
  else {
    TCHAR tmp[50];
    _stprintf(tmp, _T("%s (%d)"), _("Edit Alternates"),
        ordered_task->optional_start_points_size());
    wb->SetCaption(tmp);
  }

  EnableSizeEdit(ordered_task->get_factory_type() != TaskBehaviour::FACTORY_FAI_GENERAL);

  TCHAR bufType[100];
  TCHAR bufNamePrefix[100];

  switch (tp->GetType()) {
  case TaskPoint::START:
    _tcscpy(bufType, _T("Start point"));
    _tcscpy(bufNamePrefix, _T("Start: "));
    break;

  case TaskPoint::AST:
    _tcscpy(bufType, _T("Task point"));
    _stprintf(bufNamePrefix, _T("%d: "), active_index);
    break;

  case TaskPoint::AAT:
    _tcscpy(bufType, _T("Assigned area point"));
    _stprintf(bufNamePrefix, _T("%d: "), active_index);
    break;

  case TaskPoint::FINISH:
    _tcscpy(bufType, _T("Finish point"));
    _tcscpy(bufNamePrefix, _T("Finish: "));
    break;

  default:
    assert(true);
    break;
  }

  wf->SetCaption(bufType);

  wfrm = ((WndFrame*)wf->FindByName(_T("lblLocation")));
  if (wfrm) {
    TCHAR buff[100];
    _stprintf(buff, _T("%s %s"), bufNamePrefix, tp->GetWaypoint().name.c_str());
    wfrm->SetCaption(buff);
  }

  Refreshing = false; // reactivate onChange routines
}
示例#9
0
bool test_task_aat(TaskManager& task_manager,
                   const Waypoints &waypoints)
{
  const TaskProjection &projection =
    task_manager.get_ordered_task().get_task_projection();

  task_manager.set_factory(OrderedTask::FACTORY_AAT);
  AbstractTaskFactory &fact = task_manager.get_factory();
  const Waypoint *wp;

  task_report(task_manager, "# adding start\n");
  wp = waypoints.lookup_id(1);
  if (wp) {
    if (!fact.append(fact.createStart(*wp),false)) {
      return false;
    }
  }

  task_manager.setActiveTaskPoint(0);
  task_manager.resume();

  task_report(task_manager, "# adding intermediate\n");
  wp = waypoints.lookup_id(2);
  if (wp) {
    OrderedTaskPoint* tp = fact.createIntermediate(AbstractTaskFactory::AAT_CYLINDER,*wp);
    if (tp->get_oz()->shape == ObservationZonePoint::CYLINDER) {
      CylinderZone *cz = (CylinderZone *)tp->get_oz();
      cz->setRadius(fixed(30000.0));
      tp->update_oz(projection);
    }
    if (!fact.append(tp,false)) {
      return false;
    }
  }

  task_report(task_manager, "# adding intermediate\n");
  wp = waypoints.lookup_id(3);
  if (wp) {
    OrderedTaskPoint* tp = fact.createIntermediate(AbstractTaskFactory::AAT_CYLINDER,*wp);
    if (tp->get_oz()->shape == ObservationZonePoint::CYLINDER) {
      CylinderZone *cz = (CylinderZone *)tp->get_oz();
      cz->setRadius(fixed(40000.0));
      tp->update_oz(projection);
    }
    if (!fact.append(tp,false)) {
      return false;
    }
  }

  task_report(task_manager, "# adding finish\n");
  wp = waypoints.lookup_id(1);
  if (wp) {
    if (!fact.append(fact.createFinish(*wp),false)) {
      return false;
    }
  }

  task_report(task_manager, "# checking task..\n");
  if (!fact.validate()) {
    return false;
  }

  if (!task_manager.check_ordered_task()) {
    return false;
  }
  return true;
}
示例#10
0
 virtual void Visit(const OrderedTaskPoint& tp) {
   printf("# got an otp\n");
   ozv.Visit(*tp.get_oz());
 }
示例#11
0
void 
PrintHelper::orderedtask_print(OrderedTask& task, const AircraftState &state) 
{
  abstracttask_print(task, state);
  if (!task.stats.task_valid)
    return;

  std::ofstream fi("results/res-isolines.txt");
  for (unsigned i=0; i<task.task_points.size(); i++) {
    fi << "## point " << i << "\n";
    if (task.task_points[i]->type == TaskPoint::AAT) {
      aatpoint_print(fi, (AATPoint&)*task.task_points[i], state,
                     task.GetTaskProjection(), 1);
    } else {
      orderedtaskpoint_print(fi,*task.task_points[i],state,1);
    }
    fi << "\n";
  }

  std::ofstream f1("results/res-task.txt");

  f1 << "#### Task points\n";
  for (unsigned i=0; i<task.task_points.size(); i++) {
    f1 << "## point " << i << " ###################\n";
    if (task.task_points[i]->type == TaskPoint::AAT) {
      aatpoint_print(f1, (AATPoint&)*task.task_points[i], state,
                     task.GetTaskProjection(), 0);
    } else {
      orderedtaskpoint_print(f1,*task.task_points[i],state,0);
    }
    f1 << "\n";
  }

  std::ofstream f5("results/res-ssample.txt");
  f5 << "#### Task sampled points\n";
  for (unsigned i=0; i<task.task_points.size(); i++) {
    f5 << "## point " << i << "\n";
    sampledtaskpoint_print_samples(f5,*task.task_points[i],state);
    f5 << "\n";
  }

  std::ofstream f2("results/res-max.txt");
  f2 << "#### Max task\n";
  for (unsigned i=0; i<task.task_points.size(); i++) {
    OrderedTaskPoint *tp = task.task_points[i];
    f2 <<  tp->GetLocationMax().longitude << " "
       <<  tp->GetLocationMax().latitude << "\n";
  }

  std::ofstream f3("results/res-min.txt");
  f3 << "#### Min task\n";
  for (unsigned i=0; i<task.task_points.size(); i++) {
    OrderedTaskPoint *tp = task.task_points[i];
    f3 <<  tp->GetLocationMin().longitude << " "
       <<  tp->GetLocationMin().latitude << "\n";
  }

  std::ofstream f4("results/res-rem.txt");
  f4 << "#### Remaining task\n";
  for (unsigned i=0; i<task.task_points.size(); i++) {
    OrderedTaskPoint *tp = task.task_points[i];
    f4 <<  tp->GetLocationRemaining().longitude << " "
       <<  tp->GetLocationRemaining().latitude << "\n";
  }
}
bool test_task_mixed(TaskManager& task_manager,
                     const Waypoints &waypoints)
{
  const TaskProjection &projection =
    task_manager.get_ordered_task().get_task_projection();

  OrderedTaskPoint *tp;
  const Waypoint *wp;

  task_manager.set_factory(TaskBehaviour::FACTORY_MIXED);
  AbstractTaskFactory &fact = task_manager.get_factory();

  task_report(task_manager, "# adding start\n");
  wp = waypoints.lookup_id(1);
  if (wp) {
    tp = fact.createStart(AbstractTaskFactory::START_LINE,*wp);
    if (tp->get_oz()->shape == ObservationZonePoint::CYLINDER) {
      CylinderZone *cz = (CylinderZone *)tp->get_oz();
      cz->setRadius(fixed(5000.0));
      tp->update_oz(projection);
    }
    if (!fact.append(*tp,false)) return false;
    delete tp;
  } else {
    return false;
  }

  task_manager.setActiveTaskPoint(0);
  task_manager.resume();

  task_report(task_manager, "# adding intermdiate\n");
  wp = waypoints.lookup_id(2);
  if (wp) {
    tp = fact.createIntermediate(AbstractTaskFactory::AST_CYLINDER,*wp);
    if (!fact.append(*tp,false)) return false;
    delete tp;
  } else {
    return false;
  }

  task_report(task_manager, "# adding intermdiate\n");
  wp = waypoints.lookup_id(3);
  if (wp) {
    tp = fact.createIntermediate(AbstractTaskFactory::AAT_CYLINDER,*wp);
    if (tp->get_oz()->shape == ObservationZonePoint::CYLINDER) {
      CylinderZone *cz = (CylinderZone *)tp->get_oz();
      cz->setRadius(fixed(30000.0));
      tp->update_oz(projection);
    }
    if (!fact.append(*tp,false)) return false;
    delete tp;
  } else {
    return false;
  }

  task_report(task_manager, "# adding intermediate\n");
  wp = waypoints.lookup_id(4);
  if (wp) {
    tp = fact.createIntermediate(AbstractTaskFactory::AAT_CYLINDER,*wp);
    if (!fact.append(*tp,false)) return false;
    delete tp;
  } else {
    return false;
  }

  task_report(task_manager, "# adding intermediate\n");
  wp = waypoints.lookup_id(5);
  if (wp) {
    tp = fact.createIntermediate(AbstractTaskFactory::AAT_CYLINDER,*wp);
    if (tp->get_oz()->shape == ObservationZonePoint::CYLINDER) {
      CylinderZone *cz = (CylinderZone *)tp->get_oz();
      cz->setRadius(fixed(30000.0));
      tp->update_oz(projection);
    }
    if (!fact.append(*tp,false)) return false;
    delete tp;
  } else {
    return false;
  }

  task_report(task_manager, "# adding finish\n");
  wp = waypoints.lookup_id(1);
  if (wp) {
    tp = fact.createFinish(AbstractTaskFactory::FINISH_LINE,*wp);
    if (!fact.append(*tp,false)) return false;
    delete tp;
  } else {
    return false;
  }

  task_report(task_manager, "# checking task\n");
  if (!fact.validate()) {
    return false;
  }

  if (!task_manager.check_ordered_task()) {
    return false;
  }
  return true;
}
示例#13
0
void
RenderTaskPoint::DrawOZBackground(Canvas &canvas, const OrderedTaskPoint &tp)
{
    ozv.Draw(canvas, OZRenderer::LAYER_SHADE, m_proj, *tp.GetOZPoint(),
             index - active_index);
}
示例#14
0
Declaration::TurnPoint::TurnPoint(const OrderedTaskPoint &tp)
  :waypoint(tp.GetWaypoint()),
   shape(get_shape(tp)), radius(get_radius(tp))
{
}
示例#15
0
static fixed
GetRadius(const OrderedTaskPoint &tp)
{
  return GetRadius(*tp.GetOZPoint());
}
示例#16
0
void
TaskPointRenderer::DrawOZBackground(Canvas &canvas, const OrderedTaskPoint &tp)
{
  ozv.Draw(canvas, OZRenderer::LAYER_SHADE, m_proj, tp.GetObservationZone(),
           index - active_index);
}
示例#17
0
static void
ReadValues()
{
  OrderedTaskPoint* tp = ordered_task->get_tp(active_index);
  ObservationZonePoint &oz = *tp->get_oz();

  switch (oz.shape) {
  case ObservationZonePoint::ANNULAR_SECTOR: {
    fixed radius = Units::ToSysDistance(
        GetFormValueFixed(*wf, _T("prpOZSectorInnerRadius")));

    if (fabs(radius - ((AnnularSectorZone &)oz).getInnerRadius()) > fixed(49)) {
      ((AnnularSectorZone &)oz).setInnerRadius(radius);
      task_modified = true;
    }
  }
  case ObservationZonePoint::SECTOR: {
    fixed radius =
      Units::ToSysDistance(
          GetFormValueFixed(*wf, _T("prpOZSectorRadius")));

    if (fabs(radius - ((SectorZone &)oz).getRadius()) > fixed(49)) {
      ((SectorZone &)oz).setRadius(radius);
      task_modified = true;
    }

    fixed start_radial = GetFormValueFixed(*wf, _T("prpOZSectorStartRadial"));
    if (start_radial != ((SectorZone &)oz).getStartRadial().value_degrees()) {
      ((SectorZone &)oz).setStartRadial(Angle::degrees(start_radial));
      task_modified = true;
    }

    fixed finish_radial = GetFormValueFixed(*wf, _T("prpOZSectorFinishRadial"));
    if (finish_radial != ((SectorZone &)oz).getEndRadial().value_degrees()) {
      ((SectorZone &)oz).setEndRadial(Angle::degrees(finish_radial));
      task_modified = true;
    }
    break;
  }
  case ObservationZonePoint::LINE: {
    fixed line_length = Units::ToSysDistance(
        GetFormValueFixed(*wf, _T("prpOZLineLength")));

    if (fabs(line_length - ((LineSectorZone &)oz).getLength()) > fixed(49)) {
      ((LineSectorZone &)oz).setLength(line_length);
      task_modified = true;
    }
    break;
  }

  case ObservationZonePoint::CYLINDER: {
    fixed radius = Units::ToSysDistance(
        GetFormValueFixed(*wf, _T("prpOZCylinderRadius")));

    if (fabs(radius - ((CylinderZone &)oz).getRadius()) > fixed(49)) {
      ((CylinderZone &)oz).setRadius(radius);
      task_modified = true;
    }
    break;
  }

  default:
    break;
  }
}