本文整理汇总了C++中OrderedTask::SetOrderedTaskSettings方法的典型用法代码示例。如果您正苦于以下问题:C++ OrderedTask::SetOrderedTaskSettings方法的具体用法?C++ OrderedTask::SetOrderedTaskSettings怎么用?C++ OrderedTask::SetOrderedTaskSettings使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OrderedTask
的用法示例。
在下文中一共展示了OrderedTask::SetOrderedTaskSettings方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pser
void
Deserialiser::Deserialise(OrderedTask &task)
{
task.Clear();
task.SetFactory(GetTaskFactoryType());
task.Reset();
OrderedTaskSettings beh = task.GetOrderedTaskSettings();
Deserialise(beh);
task.SetOrderedTaskSettings(beh);
const DataNode::List children = node.ListChildrenNamed(_T("Point"));
for (const auto &i : children) {
std::unique_ptr<DataNode> point_node(i);
Deserialiser pser(*point_node, waypoints);
pser.DeserialiseTaskpoint(task);
}
}
示例2: Deserialise
void
LoadTask(OrderedTask &task, const ConstDataNode &node,
const Waypoints *waypoints)
{
task.Clear();
task.SetFactory(GetTaskFactoryType(node));
task.Reset();
OrderedTaskSettings beh = task.GetOrderedTaskSettings();
Deserialise(beh, node);
task.SetOrderedTaskSettings(beh);
const auto children = node.ListChildrenNamed(_T("Point"));
for (const auto &i : children) {
std::unique_ptr<ConstDataNode> point_node(i);
DeserialiseTaskpoint(task, *point_node, waypoints);
}
}
示例3: 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);
//.........这里部分代码省略.........
示例4: 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;
}
//.........这里部分代码省略.........