void WaypointIconRenderer::Draw(const Waypoint &waypoint, const PixelPoint &point, Reachability reachable, bool in_task) { if (waypoint.IsLandable()) DrawLandable(waypoint, point, reachable); else // non landable turnpoint GetWaypointIcon(look, waypoint, small_icons, in_task).Draw(canvas, point); }
bool GotoTask::DoGoto(const Waypoint & wp) { if (task_behaviour.goto_nonlandable || wp.IsLandable()) { delete tp; tp = new UnorderedTaskPoint(wp, task_behaviour); stats.start.Reset(); force_full_update = true; return true; } else { return false; } }
void WaypointEditWidget::Prepare(gcc_unused ContainerWindow &parent, gcc_unused const PixelRect &rc) { AddText(_("Name"), nullptr, value.name.c_str()); AddText(_("Comment"), nullptr, value.comment.c_str()); Add(_("Location"), nullptr, new GeoPointDataField(value.location,UIGlobals::GetFormatSettings().coordinate_format)); AddFloat(_("Altitude"), nullptr, _T("%.0f %s"), _T("%.0f"), 0, 30000, 5, false, UnitGroup::ALTITUDE, value.elevation); AddEnum(_("Type"), nullptr, waypoint_types, value.IsAirport() ? 1u : (value.IsLandable() ? 2u : 0u )); }
static void TestZanderWaypoint(const Waypoint org_wp, const Waypoint *wp) { if (wp == NULL) { skip(7, 0, "waypoint not found"); return; } ok1(wp->type == ((!org_wp.IsLandable()) ? Waypoint::TYPE_NORMAL : (Waypoint::Type)org_wp.type)); ok1(wp->flags.turn_point == org_wp.flags.turn_point); ok1(wp->flags.home == org_wp.flags.home); ok1(wp->flags.start_point == org_wp.flags.start_point); ok1(wp->flags.finish_point == org_wp.flags.finish_point); }
void WaypointWriter::WriteFlags(TextWriter &writer, const Waypoint &wp) { if (wp.IsAirport()) writer.write('A'); if (wp.flags.turn_point) writer.write('T'); if (wp.IsLandable()) writer.write('L'); if (wp.flags.home) writer.write('H'); if (wp.flags.start_point) writer.write('S'); if (wp.flags.finish_point) writer.write('F'); // set as turnpoint by default if nothing else if (!wp.flags.turn_point && !wp.IsLandable() && !wp.flags.home && !wp.flags.start_point && !wp.flags.finish_point) writer.write('T'); }
void WaypointEditWidget::Prepare(ContainerWindow &parent, const PixelRect &rc) { AddText(_("Name"), nullptr, value.name.c_str()); AddText(_("Comment"), nullptr, value.comment.c_str()); Add(_("Location"), nullptr, new GeoPointDataField(value.location, // TODO: use configured CoordinateFormat CoordinateFormat::DDMMSS)); AddFloat(_("Altitude"), nullptr, _T("%.0f %s"), _T("%.0f"), fixed(0), fixed(30000), fixed(5), false, UnitGroup::ALTITUDE, value.elevation); AddEnum(_("Type"), nullptr, waypoint_types, value.IsAirport() ? 1u : (value.IsLandable() ? 2u : 0u )); }
static void TestWinPilotWaypoint(const Waypoint org_wp, const Waypoint *wp) { if (wp == NULL) { skip(7, 0, "waypoint not found"); return; } ok1(wp->type == ((!org_wp.IsLandable()) ? Waypoint::TYPE_NORMAL : (Waypoint::Type)org_wp.type)); ok1(wp->flags.turn_point == org_wp.flags.turn_point); ok1(wp->flags.home == org_wp.flags.home); ok1(wp->flags.start_point == org_wp.flags.start_point); ok1(wp->flags.finish_point == org_wp.flags.finish_point); ok1(wp->runway.IsDirectionDefined() == org_wp.runway.IsDirectionDefined() && (!wp->runway.IsDirectionDefined() || wp->runway.GetDirectionDegrees() == org_wp.runway.GetDirectionDegrees())); }
static bool CompareType(const Waypoint &waypoint, TypeFilter type) { switch (type) { case TF_ALL: return true; case TF_AIRPORT: return waypoint.IsAirport(); case TF_LANDABLE: return waypoint.IsLandable(); case TF_TURNPOINT: return waypoint.IsTurnpoint(); case TF_START: return waypoint.IsStartpoint(); case TF_FINISH: return waypoint.IsFinishpoint(); case TF_FAI_TRIANGLE_LEFT: return triangle_validator->IsFAITrianglePoint(waypoint, fixed(-1)); case TF_FAI_TRIANGLE_RIGHT: return triangle_validator->IsFAITrianglePoint(waypoint, fixed_one); case TF_FILE_1: return waypoint.file_num == 1; case TF_FILE_2: return waypoint.file_num == 2; case TF_LAST_USED: return false; } /* not reachable */ return false; }
bool CAI302Device::WriteNavpoint(unsigned id, const Waypoint &wp, OperationEnvironment &env) { if (!DownloadMode(env)) return false; char name[64], remark[64]; ToASCII(name, ARRAY_SIZE(name), wp.name.c_str()); ToASCII(remark, ARRAY_SIZE(remark), wp.comment.c_str()); if (!CAI302::DownloadNavpoint(port, wp.location, (int)wp.elevation, id, wp.IsTurnpoint(), wp.IsAirport(), false, wp.IsLandable(), wp.IsStartpoint(), wp.IsFinishpoint(), wp.flags.home, false, wp.IsTurnpoint(), false, name, remark, env)) { mode = Mode::UNKNOWN; return false; } return true; }
void FormatLabel(TCHAR *buffer, size_t buffer_size, const Waypoint &way_point, WaypointRenderer::Reachability reachable, const ReachResult &reach) const { FormatTitle(buffer, buffer_size - 20, way_point); if (!way_point.IsLandable() && !way_point.flags.watched) return; if (settings.arrival_height_display == WaypointRendererSettings::ArrivalHeightDisplay::REQUIRED_GR) { if (!basic.location_available || !basic.NavAltitudeAvailable()) return; const auto safety_height = task_behaviour.safety_height_arrival; const auto target_altitude = way_point.elevation + safety_height; const auto delta_h = basic.nav_altitude - target_altitude; if (delta_h <= 0) /* no L/D if below waypoint */ return; const auto distance = basic.location.DistanceS(way_point.location); const auto gr = distance / delta_h; if (!GradientValid(gr)) return; size_t length = _tcslen(buffer); if (length > 0) buffer[length++] = _T(':'); StringFormatUnsafe(buffer + length, _T("%.1f"), (double) gr); return; } if (reachable == WaypointRenderer::Invalid) return; if (!reach.IsReachableDirect() && !way_point.flags.watched) return; if (settings.arrival_height_display == WaypointRendererSettings::ArrivalHeightDisplay::NONE) return; size_t length = _tcslen(buffer); int uah_glide = (int)Units::ToUserAltitude(reach.direct); int uah_terrain = (int)Units::ToUserAltitude(reach.terrain); if (settings.arrival_height_display == WaypointRendererSettings::ArrivalHeightDisplay::TERRAIN) { if (reach.IsReachableTerrain()) { if (length > 0) buffer[length++] = _T(':'); StringFormatUnsafe(buffer + length, _T("%d%s"), uah_terrain, altitude_unit); } return; } if (length > 0) buffer[length++] = _T(':'); if (settings.arrival_height_display == WaypointRendererSettings::ArrivalHeightDisplay::GLIDE_AND_TERRAIN && reach.IsReachableDirect() && reach.IsReachableTerrain() && reach.IsDeltaConsiderable()) { StringFormatUnsafe(buffer + length, _T("%d/%d%s"), uah_glide, uah_terrain, altitude_unit); return; } StringFormatUnsafe(buffer + length, _T("%d%s"), uah_glide, altitude_unit); }
/** * Visit method, adds result to vector * * @param wp Waypoint that is visited */ void Visit(const Waypoint& wp) { if (wp.IsLandable()) vector.push_back(wp); }
static bool IsLandable(const Waypoint &wp) { return wp.IsLandable(); }
void FormatLabel(TCHAR *buffer, const Waypoint &way_point, const ReachResult &reach) { FormatTitle(buffer, way_point); if (!way_point.IsLandable() && !way_point.flags.watched) return; if (settings.arrival_height_display == WaypointRendererSettings::ArrivalHeightDisplay::REQUIRED_GR) { if (!basic.location_available || !basic.NavAltitudeAvailable()) return; const fixed safety_height = task_behaviour.safety_height_arrival; const fixed target_altitude = way_point.elevation + safety_height; const fixed delta_h = basic.nav_altitude - target_altitude; if (!positive(delta_h)) /* no L/D if below waypoint */ return; const fixed distance = basic.location.Distance(way_point.location); const fixed gr = distance / delta_h; if (!GradientValid(gr)) return; size_t length = _tcslen(buffer); if (length > 0) buffer[length++] = _T(':'); _stprintf(buffer + length, _T("%.1f"), (double) gr); return; } if (!reach.IsReachableDirect() && !way_point.flags.watched) return; if (settings.arrival_height_display == WaypointRendererSettings::ArrivalHeightDisplay::NONE) return; size_t length = _tcslen(buffer); int uah_glide = (int)Units::ToUserAltitude(fixed(reach.direct)); int uah_terrain = (int)Units::ToUserAltitude(fixed(reach.terrain)); if (settings.arrival_height_display == WaypointRendererSettings::ArrivalHeightDisplay::TERRAIN) { if (reach.IsReachableTerrain()) { if (length > 0) buffer[length++] = _T(':'); _stprintf(buffer + length, _T("%d%s"), uah_terrain, sAltUnit); } return; } if (length > 0) buffer[length++] = _T(':'); if (settings.arrival_height_display == WaypointRendererSettings::ArrivalHeightDisplay::GLIDE_AND_TERRAIN && reach.IsReachableDirect() && reach.IsReachableTerrain() && reach.IsDeltaConsiderable()) { _stprintf(buffer + length, _T("%d/%d%s"), uah_glide, uah_terrain, sAltUnit); return; } _stprintf(buffer + length, _T("%d%s"), uah_glide, sAltUnit); }
/** * Visit method, adds result to vector * * @param wp Waypoint that is visited */ void Visit(const Waypoint& wp) { if (wp.IsLandable()) vector.emplace_back(wp); }
bool operator()(const Waypoint &wp) const { return wp.IsLandable(); }