本文整理汇总了C++中Waypoints::find_id方法的典型用法代码示例。如果您正苦于以下问题:C++ Waypoints::find_id方法的具体用法?C++ Waypoints::find_id怎么用?C++ Waypoints::find_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Waypoints
的用法示例。
在下文中一共展示了Waypoints::find_id方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setup_waypoints
/**
* Initialises waypoints with random and non-random waypoints
* for testing
*
* @param waypoints waypoints class to add waypoints to
*/
bool setup_waypoints(Waypoints &waypoints, const unsigned n)
{
Waypoint wp = waypoints.create(GeoPoint(Angle::degrees(fixed_zero),
Angle::degrees(fixed_zero)));
wp.Flags.Airport = true;
wp.Altitude = fixed(0.25);
waypoints.append(wp);
wp = waypoints.create(GeoPoint(Angle::degrees(fixed_zero),
Angle::degrees(fixed_one)));
wp.Flags.Airport = true;
wp.Altitude = fixed(0.25);
waypoints.append(wp);
wp = waypoints.create(GeoPoint(Angle::degrees(fixed_one),
Angle::degrees(fixed_one)));
wp.Name = _T("Hello");
wp.Flags.Airport = true;
wp.Altitude = fixed_half;
waypoints.append(wp);
wp = waypoints.create(GeoPoint(Angle::degrees(fixed(0.8)),
Angle::degrees(fixed(0.5))));
wp.Name = _T("Unk");
wp.Flags.Airport = true;
wp.Altitude = fixed(0.25);
waypoints.append(wp);
wp = waypoints.create(GeoPoint(Angle::degrees(fixed_one),
Angle::degrees(fixed_zero)));
wp.Flags.Airport = true;
wp.Altitude = fixed(0.25);
waypoints.append(wp);
wp = waypoints.create(GeoPoint(Angle::degrees(fixed_zero),
Angle::degrees(fixed(0.23))));
wp.Flags.Airport = true;
wp.Altitude = fixed(0.25);
waypoints.append(wp);
for (unsigned i=0; i<(unsigned)std::max((int)n-6,0); i++) {
int x = rand()%1200-100;
int y = rand()%1200-100;
double z = rand()% std::max(terrain_height,1);
wp = waypoints.create(GeoPoint(Angle::degrees(fixed(x/1000.0)),
Angle::degrees(fixed(y/1000.0))));
wp.Flags.Airport = false;
wp.Altitude = fixed(z);
waypoints.append(wp);
}
waypoints.optimise();
if (verbose) {
std::ofstream fin("results/res-wp-in.txt");
for (unsigned i=1; i<=waypoints.size(); i++) {
Waypoints::WaypointTree::const_iterator it = waypoints.find_id(i);
if (it != waypoints.end()) {
#ifdef DO_PRINT
fin << it->get_waypoint();
#endif
}
}
}
return true;
}