コード例 #1
0
ファイル: harness_task.cpp プロジェクト: j-konopka/XCSoar-TE
    void Visit(const ObservationZonePoint &oz) {
        switch (oz.GetShape()) {
        case ObservationZone::Shape::FAI_SECTOR:
        case ObservationZone::Shape::SECTOR:
            Visit((const SectorZone &)oz);
            break;

        case ObservationZone::Shape::LINE:
            Visit((const LineSectorZone &)oz);
            break;

        case ObservationZone::Shape::MAT_CYLINDER:
        case ObservationZone::Shape::CYLINDER:
            Visit((const CylinderZone &)oz);
            break;

        case ObservationZone::Shape::CUSTOM_KEYHOLE:
        case ObservationZone::Shape::DAEC_KEYHOLE:
        case ObservationZone::Shape::BGAFIXEDCOURSE:
        case ObservationZone::Shape::BGAENHANCEDOPTION:
        case ObservationZone::Shape::BGA_START:
            Visit((const KeyholeZone &)oz);
            break;

        case ObservationZone::Shape::ANNULAR_SECTOR:
            Visit((const AnnularSectorZone &)oz);
            break;

        case ObservationZone::Shape::SYMMETRIC_QUADRANT:
            Visit((const SymmetricSectorZone &)oz);
            break;
        }
    }
コード例 #2
0
ファイル: Serialiser.cpp プロジェクト: ThomasXBMC/XCSoar
static void
Serialise(WritableDataNode &node, const ObservationZonePoint &data)
{
  switch (data.GetShape()) {
  case ObservationZone::Shape::FAI_SECTOR:
    node.SetAttribute(_T("type"), _T("FAISector"));
    break;

  case ObservationZone::Shape::SECTOR:
    Visit(node, (const SectorZone &)data);
    break;

  case ObservationZone::Shape::LINE:
    Visit(node, (const LineSectorZone &)data);
    break;

  case ObservationZone::Shape::MAT_CYLINDER:
    node.SetAttribute(_T("type"), _T("MatCylinder"));
    break;

  case ObservationZone::Shape::CYLINDER:
    Visit(node, (const CylinderZone &)data);
    break;

  case ObservationZone::Shape::CUSTOM_KEYHOLE: {
    const KeyholeZone &keyhole = (const KeyholeZone &)data;
    node.SetAttribute(_T("type"), _T("CustomKeyhole"));
    node.SetAttribute(_T("inner_radius"), keyhole.GetInnerRadius());
    break;
  }

  case ObservationZone::Shape::DAEC_KEYHOLE:
    node.SetAttribute(_T("type"), _T("Keyhole"));
    break;

  case ObservationZone::Shape::BGAFIXEDCOURSE:
    node.SetAttribute(_T("type"), _T("BGAFixedCourse"));
    break;

  case ObservationZone::Shape::BGAENHANCEDOPTION:
    node.SetAttribute(_T("type"), _T("BGAEnhancedOption"));
    break;

  case ObservationZone::Shape::BGA_START:
    node.SetAttribute(_T("type"), _T("BGAStartSector"));
    break;

  case ObservationZone::Shape::ANNULAR_SECTOR:
    Visit(node, (const AnnularSectorZone &)data);
    break;

  case ObservationZone::Shape::SYMMETRIC_QUADRANT:
    Visit(node, (const SymmetricSectorZone &)data);
    break;
  }
} 
コード例 #3
0
void
OrderedTaskPointRadiusLabel(const ObservationZonePoint &ozp, TCHAR* buffer)
{
  switch (ozp.GetShape()) {
  case ObservationZonePoint::FAI_SECTOR:
    _tcscpy(buffer, _("FAI quadrant"));
    return;

  case ObservationZonePoint::SECTOR:
  case ObservationZonePoint::ANNULAR_SECTOR:
    _stprintf(buffer,_T("%s - %s: %.1f%s"), _("Sector"), _("Radius"),
              (double)Units::ToUserDistance(((const SectorZone &)ozp).GetRadius()),
              Units::GetDistanceName());
    return;

  case ObservationZonePoint::LINE:
    _stprintf(buffer,_T("%s - %s: %.1f%s"), _("Line"), _("Gate Width"),
              (double)Units::ToUserDistance(((const LineSectorZone &)ozp).GetLength()),
              Units::GetDistanceName());
    return;

  case ObservationZonePoint::CYLINDER:
    _stprintf(buffer,_T("%s - %s: %.1f%s"), _("Cylinder"), _("Radius"),
              (double)Units::ToUserDistance(((const CylinderZone &)ozp).GetRadius()),
              Units::GetDistanceName());
    return;

  case ObservationZonePoint::KEYHOLE:
    _tcscpy(buffer, _("DAeC Keyhole"));
    return;

  case ObservationZonePoint::BGAFIXEDCOURSE:
    _tcscpy(buffer, _("BGA Fixed Course"));
    return;

  case ObservationZonePoint::BGAENHANCEDOPTION:
    _tcscpy(buffer, _("BGA Enhanced Option"));
    return;

  case ObservationZonePoint::BGA_START:
    _tcscpy(buffer, _("BGA Start Sector"));
    return;
  }

  gcc_unreachable();
  assert(false);
}
コード例 #4
0
static fixed
GetRadius(const ObservationZonePoint &oz)
{
  switch (oz.GetShape()) {
  case ObservationZonePoint::LINE:
  case ObservationZonePoint::CYLINDER:
  case ObservationZonePoint::SECTOR:
  case ObservationZonePoint::FAI_SECTOR:
  case ObservationZonePoint::KEYHOLE:
  case ObservationZonePoint::BGAFIXEDCOURSE:
  case ObservationZonePoint::BGAENHANCEDOPTION:
  case ObservationZonePoint::BGA_START:
  case ObservationZonePoint::ANNULAR_SECTOR:
    const CylinderZone &cz = (const CylinderZone &)oz;
    return cz.GetRadius();
  }

  return fixed(1);
}
コード例 #5
0
static fixed
GetOZSize(const ObservationZonePoint &oz)
{
  switch (oz.GetShape()) {
  case ObservationZone::Shape::SECTOR:
  case ObservationZone::Shape::SYMMETRIC_QUADRANT:
    return ((const SectorZone &)oz).GetRadius();

  case ObservationZone::Shape::LINE:
    return ((const LineSectorZone &)oz).GetLength();

  case ObservationZone::Shape::CYLINDER:
  case ObservationZone::Shape::MAT_CYLINDER:
    return ((const CylinderZone &)oz).GetRadius();

  case ObservationZone::Shape::ANNULAR_SECTOR:
    return ((const AnnularSectorZone &)oz).GetRadius();

  default:
    return fixed(-1);
  }
}
コード例 #6
0
ファイル: TargetMapWindow.cpp プロジェクト: Advi42/XCSoar
gcc_pure
static double
GetRadius(const ObservationZonePoint &oz)
{
  switch (oz.GetShape()) {
  case ObservationZone::Shape::LINE:
  case ObservationZone::Shape::MAT_CYLINDER:
  case ObservationZone::Shape::CYLINDER:
  case ObservationZone::Shape::SECTOR:
  case ObservationZone::Shape::FAI_SECTOR:
  case ObservationZone::Shape::CUSTOM_KEYHOLE:
  case ObservationZone::Shape::DAEC_KEYHOLE:
  case ObservationZone::Shape::BGAFIXEDCOURSE:
  case ObservationZone::Shape::BGAENHANCEDOPTION:
  case ObservationZone::Shape::BGA_START:
  case ObservationZone::Shape::ANNULAR_SECTOR:
  case ObservationZone::Shape::SYMMETRIC_QUADRANT:
    const CylinderZone &cz = (const CylinderZone &)oz;
    return cz.GetRadius();
  }

  return 1;
}
コード例 #7
0
ファイル: RunRenderOZ.cpp プロジェクト: j-konopka/XCSoar-TE
    void set_shape(ObservationZone::Shape shape) {
        if (oz != NULL && shape == oz->GetShape())
            return;

        delete oz;
        oz = NULL;

        fixed radius(10000);

        switch (shape) {
        case ObservationZone::Shape::LINE:
            oz = new LineSectorZone(location, 2 * radius);
            break;

        case ObservationZone::Shape::CYLINDER:
            oz = new CylinderZone(location, radius);
            break;

        case ObservationZone::Shape::MAT_CYLINDER:
            oz = CylinderZone::CreateMatCylinderZone(location);
            break;

        case ObservationZone::Shape::SECTOR:
            oz = new SectorZone(location, radius,
                                Angle::Degrees(0), Angle::Degrees(70));
            break;

        case ObservationZone::Shape::ANNULAR_SECTOR:
            oz = new AnnularSectorZone(location, radius,
                                       Angle::Degrees(0), Angle::Degrees(70),
                                       Half(radius));
            break;

        case ObservationZone::Shape::FAI_SECTOR:
            oz = SymmetricSectorZone::CreateFAISectorZone(location);
            break;

        case ObservationZone::Shape::CUSTOM_KEYHOLE:
            oz = KeyholeZone::CreateCustomKeyholeZone(location, fixed(10000),
                    Angle::QuarterCircle());
            break;

        case ObservationZone::Shape::DAEC_KEYHOLE:
            oz = KeyholeZone::CreateDAeCKeyholeZone(location);
            break;

        case ObservationZone::Shape::BGAFIXEDCOURSE:
            oz = KeyholeZone::CreateBGAFixedCourseZone(location);
            break;

        case ObservationZone::Shape::BGAENHANCEDOPTION:
            oz = KeyholeZone::CreateBGAEnhancedOptionZone(location);
            break;

        case ObservationZone::Shape::BGA_START:
            oz = KeyholeZone::CreateBGAStartSectorZone(location);
            break;

        case ObservationZone::Shape::SYMMETRIC_QUADRANT:
            oz = new SymmetricSectorZone(location);
            break;
        }

        if (oz != NULL)
            oz->SetLegs(&previous, &next);

        if (IsDefined())
            Invalidate();
    }
コード例 #8
0
 ObservationZonePoint(const ObservationZonePoint &other,
                      const GeoPoint &_reference)
   :ObservationZone(other.GetShape(), other.CanStartThroughTop()),
    reference(_reference) {}
コード例 #9
0
ファイル: OZRenderer.cpp プロジェクト: nkgautam/XCSoar
void
OZRenderer::Draw(Canvas &canvas, Layer layer, const Projection &projection,
                 const ObservationZonePoint &_oz, int offset)
{
  if (layer == LAYER_SHADE && offset < 0)
    return;

  Prepare(canvas, layer, offset);

  switch (_oz.GetShape()) {
  case ObservationZone::Shape::LINE:
  case ObservationZone::Shape::FAI_SECTOR: {
    const SectorZone &oz = (const SectorZone &)_oz;

    auto p_center = projection.GeoToScreen(oz.GetReference());
    if (layer != LAYER_ACTIVE)
      canvas.DrawSegment(p_center,
                         projection.GeoToScreenDistance(oz.GetRadius()),
                         oz.GetStartRadial() - projection.GetScreenAngle(),
                         oz.GetEndRadial() - projection.GetScreenAngle());
    else {
      auto p_start = projection.GeoToScreen(oz.GetSectorStart());
      auto p_end = projection.GeoToScreen(oz.GetSectorEnd());

      canvas.DrawTwoLines(p_start, p_center, p_end);
    }

    break;
  }

  case ObservationZone::Shape::MAT_CYLINDER:
  case ObservationZone::Shape::CYLINDER: {
    const CylinderZone &oz = (const CylinderZone &)_oz;

    if (layer != LAYER_INACTIVE) {
      auto p_center = projection.GeoToScreen(oz.GetReference());
      canvas.DrawCircle(p_center.x, p_center.y,
                    projection.GeoToScreenDistance(oz.GetRadius()));
    }

    break;
  }

  case ObservationZone::Shape::BGA_START:
  case ObservationZone::Shape::SYMMETRIC_QUADRANT:
  case ObservationZone::Shape::SECTOR: {
    const SectorZone &oz = (const SectorZone &)_oz;

    if (layer != LAYER_INACTIVE) {
      auto p_center = projection.GeoToScreen(oz.GetReference());

      canvas.DrawSegment(p_center,
                         projection.GeoToScreenDistance(oz.GetRadius()),
                         oz.GetStartRadial() - projection.GetScreenAngle(),
                         oz.GetEndRadial() - projection.GetScreenAngle());

      auto p_start = projection.GeoToScreen(oz.GetSectorStart());
      auto p_end = projection.GeoToScreen(oz.GetSectorEnd());
      canvas.DrawTwoLines(p_start, p_center, p_end);
    }

    break;
  }

  case ObservationZone::Shape::CUSTOM_KEYHOLE:
  case ObservationZone::Shape::DAEC_KEYHOLE:
  case ObservationZone::Shape::BGAFIXEDCOURSE:
  case ObservationZone::Shape::BGAENHANCEDOPTION: {
    const KeyholeZone &oz = (const KeyholeZone &)_oz;
    auto p_center = projection.GeoToScreen(oz.GetReference());
    canvas.DrawKeyhole(p_center,
                       projection.GeoToScreenDistance(oz.GetInnerRadius()),
                       projection.GeoToScreenDistance(oz.GetRadius()),
                       oz.GetStartRadial() - projection.GetScreenAngle(),
                       oz.GetEndRadial() - projection.GetScreenAngle());

    break;
  }

  case ObservationZone::Shape::ANNULAR_SECTOR: {
    const AnnularSectorZone &oz = (const AnnularSectorZone &)_oz;
    auto p_center = projection.GeoToScreen(oz.GetReference());
    canvas.DrawAnnulus(p_center,
                       projection.GeoToScreenDistance(oz.GetInnerRadius()),
                       projection.GeoToScreenDistance(oz.GetRadius()),
                       oz.GetStartRadial() - projection.GetScreenAngle(),
                       oz.GetEndRadial() - projection.GetScreenAngle());
  }

  }

  Finish(canvas, layer);
}