本文整理汇总了C++中Waypoints::IsEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ Waypoints::IsEmpty方法的具体用法?C++ Waypoints::IsEmpty怎么用?C++ Waypoints::IsEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Waypoints
的用法示例。
在下文中一共展示了Waypoints::IsEmpty方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: center
int
main(int argc, char** argv)
{
if (!ParseArgs(argc, argv))
return 0;
plan_tests(52);
Waypoints waypoints;
GeoPoint center(Angle::Degrees(51.4), Angle::Degrees(7.85));
// AddSpiralWaypoints creates 151 waypoints from
// 0km to 150km distance in 1km steps
AddSpiralWaypoints(waypoints, center);
ok1(!waypoints.IsEmpty());
ok1(waypoints.size() == 151);
TestLookups(waypoints, center);
TestNamePrefixVisitor(waypoints);
TestRangeVisitor(waypoints, center);
TestGetNearest(waypoints, center);
TestIterator(waypoints);
ok(TestCopy(waypoints), "waypoint copy", 0);
ok(TestErase(waypoints, 3), "waypoint erase", 0);
ok(TestReplace(waypoints, 4), "waypoint replace", 0);
// test clear
waypoints.Clear();
ok1(waypoints.IsEmpty());
ok1(waypoints.size() == 0);
return exit_status();
}
示例2: WaypointFactory
static bool
TestWaypointFile(const TCHAR* filename, Waypoints &way_points, unsigned num_wps)
{
NullOperationEnvironment operation;
if (!ok1(ReadWaypointFile(filename, way_points,
WaypointFactory(WaypointOrigin::NONE),
operation))) {
skip(2, 0, "parsing waypoint file failed");
return false;
}
way_points.Optimise();
ok1(!way_points.IsEmpty());
ok1(way_points.size() == num_wps);
return true;
}
示例3: LogStartUp
void
WaypointGlue::SetHome(Waypoints &way_points, const RasterTerrain *terrain,
ComputerSettings &settings,
const bool reset)
{
LogStartUp(_T("SetHome"));
if (reset)
settings.poi.home_waypoint = -1;
// check invalid home waypoint or forced reset due to file change
const Waypoint *wp = FindHomeId(way_points, settings.poi);
if (wp == NULL) {
/* fall back to HomeLocation, try to find it in the waypoint
database */
wp = FindHomeLocation(way_points, settings.poi);
if (wp == NULL)
// search for home in waypoint list, if we don't have a home
wp = FindFlaggedHome(way_points, settings.poi);
}
// check invalid task ref waypoint or forced reset due to file change
if (reset || way_points.IsEmpty() ||
!way_points.LookupId(settings.team_code.team_code_reference_waypoint))
// set team code reference waypoint if we don't have one
settings.team_code.team_code_reference_waypoint = settings.poi.home_waypoint;
if (device_blackboard != NULL) {
if (wp != NULL) {
// OK, passed all checks now
LogStartUp(_T("Start at home waypoint"));
device_blackboard->SetStartupLocation(wp->location, wp->altitude);
} else if (terrain != NULL) {
// no home at all, so set it from center of terrain if available
GeoPoint loc = terrain->GetTerrainCenter();
LogStartUp(_T("Start at terrain center"));
device_blackboard->SetStartupLocation(loc,
fixed(terrain->GetTerrainHeight(loc)));
}
}
}
示例4: f
static bool
TestWaypointFile(const TCHAR* filename, Waypoints &way_points, unsigned num_wps)
{
WaypointReader f(filename, 0);
if (!ok1(!f.Error())) {
skip(3, 0, "opening waypoint file failed");
return false;
}
NullOperationEnvironment operation;
if(!ok1(f.Parse(way_points, operation))) {
skip(2, 0, "parsing waypoint file failed");
return false;
}
way_points.Optimise();
ok1(!way_points.IsEmpty());
ok1(way_points.size() == num_wps);
return true;
}
示例5: f
static bool
test_replay_retrospective()
{
Directory::Create(_T("output/results"));
std::ofstream f("output/results/res-sample.txt");
Waypoints waypoints;
WaypointReader w(waypoint_file.c_str(), 0);
if (!ok1(!w.Error())) {
printf("# waypoint file %s\n", waypoint_file.c_str());
skip(2, 0, "opening waypoint file failed");
return false;
}
NullOperationEnvironment operation;
if(!ok1(w.Parse(waypoints, operation))) {
skip(1, 0, "parsing waypoint file failed");
return false;
}
waypoints.Optimise();
ok1(!waypoints.IsEmpty());
Retrospective retro(waypoints);
retro.search_range = range_threshold;
retro.angle_tolerance = Angle::Degrees(autopilot_parms.bearing_noise);
FileLineReaderA *reader = new FileLineReaderA(replay_file.c_str());
if (reader->error()) {
delete reader;
return false;
}
waypoints.Optimise();
IgcReplay sim(reader);
NMEAInfo basic;
basic.Reset();
while (sim.Update(basic)) {
n_samples++;
if (retro.UpdateSample(basic.location)) {
std::ofstream g("output/results/res-retro.txt");
// report task
auto candidate_list = retro.getNearWaypointList();
for (auto it = candidate_list.begin(); it != candidate_list.end(); ++it) {
const Waypoint& wp = it->waypoint;
g << (double)wp.location.longitude.Degrees() << " "
<< (double)wp.location.latitude.Degrees() << " "
<< "\"" << wp.name << "\"\n";
}
}
f << (double)basic.time << " "
<< (double)basic.location.longitude.Degrees() << " "
<< (double)basic.location.latitude.Degrees() << "\n";
f.flush();
};
double d_ach, d_can;
retro.CalcDistances(d_ach, d_can);
printf("# distances %f %f\n", (double)d_ach, (double)d_can);
printf("# size %d\n", retro.getNearWaypointList().size());
return true;
}