本文整理汇总了C++中OrderedTask::GetFactoryType方法的典型用法代码示例。如果您正苦于以下问题:C++ OrderedTask::GetFactoryType方法的具体用法?C++ OrderedTask::GetFactoryType怎么用?C++ OrderedTask::GetFactoryType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OrderedTask
的用法示例。
在下文中一共展示了OrderedTask::GetFactoryType方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
TaskRenderer::Draw(const OrderedTask &task)
{
tpv.SetBoundingBox(task.GetBoundingBox(screen_bounds));
tpv.SetActiveIndex(task.GetActiveIndex());
for (unsigned i = 0; i < 4; i++) {
tpv.ResetIndex();
if (i != TaskPointRenderer::LAYER_SYMBOLS &&
i != TaskPointRenderer::LAYER_LEG) {
tpv.SetModeOptional(true);
for (const auto &tp : task.GetOptionalStartPoints())
tpv.Draw(tp, (TaskPointRenderer::Layer)i);
}
tpv.SetModeOptional(false);
for (const auto &tp : task.GetPoints())
tpv.Draw(tp, (TaskPointRenderer::Layer)i);
}
if (task.GetFactoryType() == TaskFactoryType::MAT) {
// now draw MAT circles
tpv.ResetIndex();
tpv.SetModeOptional(false);
for (const auto *i : task.GetMatPoints())
tpv.Draw(*i, (TaskPointRenderer::Layer)2);
}
}
示例2: IsFAITriangleApplicable
gcc_pure
static bool
IsFAITriangleApplicable(const OrderedTask &task)
{
return IsFAITriangleApplicable(task.GetFactoryType()) &&
!task.HasOptionalStarts() &&
// TODO: allow start on first leg
task.TaskSize() >= 2 && task.TaskSize() <= 4;
}
示例3: GetTaskFactoryType
void
Serialiser::Serialise(const OrderedTask &task)
{
node.SetAttribute(_T("type"), GetTaskFactoryType(task.GetFactoryType()));
Serialise(task.GetOrderedTaskBehaviour());
mode_optional_start = false;
task.AcceptTaskPointVisitor(*this);
mode_optional_start = true;
task.AcceptStartPointVisitor(*this);
}
示例4: GetTaskFactoryType
void
SaveTask(WritableDataNode &node, const OrderedTask &task)
{
node.SetAttribute(_T("type"), GetTaskFactoryType(task.GetFactoryType()));
Serialise(node, task.GetOrderedTaskSettings());
for (const auto &tp : task.GetPoints())
Serialise(node, tp, false);
for (const auto &tp : task.GetOptionalStartPoints())
Serialise(node, tp, true);
}
示例5: GetTaskFactoryType
void
Serialiser::Serialise(const OrderedTask &task)
{
node.SetAttribute(_T("type"), GetTaskFactoryType(task.GetFactoryType()));
Serialise(task.GetOrderedTaskBehaviour());
mode_optional_start = false;
for (const auto &tp : task.GetPoints())
Serialise(tp);
mode_optional_start = true;
for (const auto &tp : task.GetOptionalStartPoints())
Serialise(tp);
}
示例6: PanelWidget
void
TaskPointWidget::RefreshView()
{
map.Invalidate();
OrderedTaskPoint &tp = ordered_task->GetPoint(active_index);
properties_dock.SetWidget(new PanelWidget());
ObservationZonePoint &oz = tp.GetObservationZone();
const bool is_fai_general =
ordered_task->GetFactoryType() == TaskFactoryType::FAI_GENERAL;
properties_widget = CreateObservationZoneEditWidget(oz, is_fai_general);
if (properties_widget != nullptr) {
properties_widget->SetListener(this);
properties_dock.SetWidget(properties_widget);
}
type_label.SetCaption(OrderedTaskPointName(ordered_task->GetFactory().GetType(tp)));
previous_button->SetEnabled(active_index > 0);
next_button->SetEnabled(active_index < (ordered_task->TaskSize() - 1));
optional_starts.SetVisible(active_index == 0);
if (!ordered_task->HasOptionalStarts())
optional_starts.SetCaption(_("Enable Alternate Starts"));
else {
StaticString<50> tmp;
tmp.Format(_T("%s (%d)"), _("Edit Alternates"),
ordered_task->GetOptionalStartPointCount());
optional_starts.SetCaption(tmp);
}
if (tp.GetType() == TaskPointType::AST) {
const ASTPoint &ast = (const ASTPoint &)tp;
score_exit.Show();
score_exit.SetState(ast.GetScoreExit());
} else
score_exit.Hide();
StaticString<100> name_prefix_buffer, type_buffer;
switch (tp.GetType()) {
case TaskPointType::START:
type_buffer = _("Start point");
name_prefix_buffer = _T("Start: ");
break;
case TaskPointType::AST:
type_buffer = _("Task point");
name_prefix_buffer.Format(_T("%d: "), active_index);
break;
case TaskPointType::AAT:
type_buffer = _("Assigned area point");
name_prefix_buffer.Format(_T("%d: "), active_index);
break;
case TaskPointType::FINISH:
type_buffer = _("Finish point");
name_prefix_buffer = _T("Finish: ");
break;
default:
gcc_unreachable();
}
dialog.SetCaption(type_buffer);
{
StaticString<100> buffer;
buffer.Format(_T("%s %s"), name_prefix_buffer.c_str(),
tp.GetWaypoint().name.c_str());
waypoint_name.SetCaption(buffer);
}
}
示例7: reader
OrderedTask*
TaskFileSeeYou::GetTask(const TaskBehaviour &task_behaviour,
const Waypoints *waypoints, unsigned index) const
{
// Create FileReader for reading the task
FileLineReader reader(path, ConvertLineReader::AUTO);
if (reader.error())
return NULL;
// Read waypoints from the CUP file
Waypoints file_waypoints;
{
WaypointReaderSeeYou waypoint_file(0);
NullOperationEnvironment operation;
waypoint_file.Parse(file_waypoints, reader, operation);
}
file_waypoints.Optimise();
if (!reader.Rewind())
return NULL;
TCHAR *line = AdvanceReaderToTask(reader, index);
if (line == NULL)
return NULL;
// Read waypoint list
// e.g. "Club day 4 Racing task","085PRI","083BOJ","170D_K","065SKY","0844YY", "0844YY"
// TASK NAME , TAKEOFF, START , TP1 , TP2 , FINISH , LANDING
TCHAR waypoints_buffer[1024];
const TCHAR *wps[30];
size_t n_waypoints = WaypointReaderBase::
ExtractParameters(line, waypoints_buffer, wps, 30, true, _T('"')) - 3;
SeeYouTaskInformation task_info;
SeeYouTurnpointInformation turnpoint_infos[30];
const Waypoint *waypoints_in_task[30];
ParseCUTaskDetails(reader, &task_info, turnpoint_infos);
OrderedTask *task = new OrderedTask(task_behaviour);
task->SetFactory(task_info.wp_dis ?
TaskFactoryType::RACING : TaskFactoryType::AAT);
AbstractTaskFactory& fact = task->GetFactory();
const TaskFactoryType factType = task->GetFactoryType();
OrderedTaskSettings beh = task->GetOrderedTaskSettings();
if (factType == TaskFactoryType::AAT) {
beh.aat_min_time = task_info.task_time;
}
if (factType == TaskFactoryType::AAT ||
factType == TaskFactoryType::RACING) {
beh.start_constraints.max_height = (unsigned)task_info.max_start_altitude;
beh.start_constraints.max_height_ref = AltitudeReference::MSL;
}
task->SetOrderedTaskSettings(beh);
// mark task waypoints. Skip takeoff and landing point
for (unsigned i = 0; i < n_waypoints; i++) {
const Waypoint* file_wp = file_waypoints.LookupName(wps[i + 2]);
if (file_wp == NULL)
return NULL;
// Try to find waypoint by name
const Waypoint* wp = waypoints->LookupName(file_wp->name);
// If waypoint by name found and closer than 10m to the original
if (wp != NULL &&
wp->location.Distance(file_wp->location) <= fixed(10)) {
// Use this waypoint for the task
waypoints_in_task[i] = wp;
continue;
}
// Try finding the closest waypoint to the original one
wp = waypoints->GetNearest(file_wp->location, fixed(10));
// If closest waypoint found and closer than 10m to the original
if (wp != NULL &&
wp->location.Distance(file_wp->location) <= fixed(10)) {
// Use this waypoint for the task
waypoints_in_task[i] = wp;
continue;
}
// Use the original waypoint
waypoints_in_task[i] = file_wp;
}
//now create TPs and OZs
for (unsigned i = 0; i < n_waypoints; i++) {
ObservationZonePoint* oz = CreateOZ(turnpoint_infos[i], i, n_waypoints,
waypoints_in_task, factType);
assert(waypoints_in_task[i]);
OrderedTaskPoint *pt = CreatePoint(i, n_waypoints, waypoints_in_task[i],
fact, oz, factType);
if (pt != NULL)
fact.Append(*pt, false);
//.........这里部分代码省略.........
示例8: reader
OrderedTask*
TaskFileSeeYou::GetTask(const TaskBehaviour &task_behaviour,
const Waypoints *waypoints, unsigned index) const
{
// Create FileReader for reading the task
FileLineReader reader(path, IgnoreError(), Charset::AUTO);
if (reader.error())
return nullptr;
// Read waypoints from the CUP file
Waypoints file_waypoints;
{
const WaypointFactory factory(WaypointOrigin::NONE);
WaypointReaderSeeYou waypoint_file(factory);
NullOperationEnvironment operation;
waypoint_file.Parse(file_waypoints, reader, operation);
}
file_waypoints.Optimise();
if (!reader.Rewind())
return nullptr;
TCHAR *line = AdvanceReaderToTask(reader, index);
if (line == nullptr)
return nullptr;
// Read waypoint list
// e.g. "Club day 4 Racing task","085PRI","083BOJ","170D_K","065SKY","0844YY", "0844YY"
// TASK NAME , TAKEOFF, START , TP1 , TP2 , FINISH , LANDING
TCHAR waypoints_buffer[1024];
const TCHAR *wps[30];
size_t n_waypoints = ExtractParameters(line, waypoints_buffer, wps, 30,
true, _T('"'));
// Some versions of StrePla append a trailing ',' without a following
// WP name resulting an empty last entry. Remove it from the results
if (n_waypoints > 0 && wps[n_waypoints - 1][0] == _T('\0'))
n_waypoints --;
// At least taskname and takeoff, start, finish and landing points are needed
if (n_waypoints < 5)
return nullptr;
// Remove taskname, start point and landing point from count
n_waypoints -= 3;
SeeYouTaskInformation task_info;
SeeYouTurnpointInformation turnpoint_infos[30];
WaypointPtr waypoints_in_task[30];
ParseCUTaskDetails(reader, &task_info, turnpoint_infos);
OrderedTask *task = new OrderedTask(task_behaviour);
task->SetFactory(task_info.wp_dis ?
TaskFactoryType::RACING : TaskFactoryType::AAT);
AbstractTaskFactory& fact = task->GetFactory();
const TaskFactoryType factType = task->GetFactoryType();
OrderedTaskSettings beh = task->GetOrderedTaskSettings();
if (factType == TaskFactoryType::AAT) {
beh.aat_min_time = task_info.task_time;
}
if (factType == TaskFactoryType::AAT ||
factType == TaskFactoryType::RACING) {
beh.start_constraints.max_height = (unsigned)task_info.max_start_altitude;
beh.start_constraints.max_height_ref = AltitudeReference::MSL;
}
task->SetOrderedTaskSettings(beh);
// mark task waypoints. Skip takeoff and landing point
for (unsigned i = 0; i < n_waypoints; i++) {
auto file_wp = file_waypoints.LookupName(wps[i + 2]);
if (file_wp == nullptr)
return nullptr;
// Try to find waypoint by name
auto wp = waypoints->LookupName(file_wp->name);
// If waypoint by name found and closer than 10m to the original
if (wp != nullptr &&
wp->location.DistanceS(file_wp->location) <= fixed(10)) {
// Use this waypoint for the task
waypoints_in_task[i] = wp;
continue;
}
// Try finding the closest waypoint to the original one
wp = waypoints->GetNearest(file_wp->location, fixed(10));
// If closest waypoint found and closer than 10m to the original
if (wp != nullptr &&
wp->location.DistanceS(file_wp->location) <= fixed(10)) {
// Use this waypoint for the task
waypoints_in_task[i] = wp;
continue;
}
// Use the original waypoint
waypoints_in_task[i] = file_wp;
}
//.........这里部分代码省略.........