本文整理汇总了C++中Airspaces::QueryAll方法的典型用法代码示例。如果您正苦于以下问题:C++ Airspaces::QueryAll方法的具体用法?C++ Airspaces::QueryAll怎么用?C++ Airspaces::QueryAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Airspaces
的用法示例。
在下文中一共展示了Airspaces::QueryAll方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: skip
static void
TestOpenAir()
{
Airspaces airspaces;
if (!ParseFile(Path(_T("test/data/airspace/openair.txt")), airspaces)) {
skip(3, 0, "Failed to parse input file");
return;
}
const AirspaceClassTestCouple classes[] = {
{ _T("Class-R-Test"), RESTRICT },
{ _T("Class-Q-Test"), DANGER },
{ _T("Class-P-Test"), PROHIBITED },
{ _T("Class-CTR-Test"), CTR },
{ _T("Class-A-Test"), CLASSA },
{ _T("Class-B-Test"), CLASSB },
{ _T("Class-C-Test"), CLASSC },
{ _T("Class-D-Test"), CLASSD },
{ _T("Class-GP-Test"), NOGLIDER },
{ _T("Class-W-Test"), WAVE },
{ _T("Class-E-Test"), CLASSE },
{ _T("Class-F-Test"), CLASSF },
{ _T("Class-TMZ-Test"), TMZ },
{ _T("Class-G-Test"), CLASSG },
{ _T("Class-RMZ-Test"), RMZ },
};
ok1(airspaces.GetSize() == 24);
const auto range = airspaces.QueryAll();
for (auto it = range.begin(); it != range.end(); ++it) {
const AbstractAirspace &airspace = it->GetAirspace();
if (StringIsEqual(_T("Circle-Test"), airspace.GetName())) {
if (!ok1(airspace.GetShape() == AbstractAirspace::Shape::CIRCLE))
continue;
const AirspaceCircle &circle = (const AirspaceCircle &)airspace;
ok1(equals(circle.GetRadius(), Units::ToSysUnit(5, Unit::NAUTICAL_MILES)));
ok1(equals(circle.GetReferenceLocation(),
Angle::Degrees(1.091667), Angle::Degrees(0.091667)));
} else if (StringIsEqual(_T("Polygon-Test"), airspace.GetName())) {
if (!ok1(airspace.GetShape() == AbstractAirspace::Shape::POLYGON))
continue;
const AirspacePolygon &polygon = (const AirspacePolygon &)airspace;
const SearchPointVector &points = polygon.GetPoints();
if (!ok1(points.size() == 5))
continue;
ok1(equals(points[0].GetLocation(),
Angle::DMS(1, 30, 30),
Angle::DMS(1, 30, 30, true)));
ok1(equals(points[1].GetLocation(),
Angle::DMS(1, 30, 30),
Angle::DMS(1, 30, 30)));
ok1(equals(points[2].GetLocation(),
Angle::DMS(1, 30, 30, true),
Angle::DMS(1, 30, 30)));
ok1(equals(points[3].GetLocation(),
Angle::DMS(1, 30, 30, true),
Angle::DMS(1, 30, 30, true)));
ok1(equals(points[4].GetLocation(),
Angle::DMS(1, 30, 30),
Angle::DMS(1, 30, 30, true)));
} else if (StringIsEqual(_T("Radio-Test"), airspace.GetName())) {
ok1(StringIsEqual(_T("130.125 MHz"), airspace.GetRadioText().c_str()));
} else if (StringIsEqual(_T("Height-Test-1"), airspace.GetName())) {
ok1(airspace.GetBase().IsTerrain());
ok1(airspace.GetTop().reference == AltitudeReference::MSL);
ok1(equals(airspace.GetTop().altitude,
Units::ToSysUnit(2000, Unit::FEET)));
} else if (StringIsEqual(_T("Height-Test-2"), airspace.GetName())) {
ok1(airspace.GetBase().reference == AltitudeReference::MSL);
ok1(equals(airspace.GetBase().altitude, 0));
ok1(airspace.GetTop().reference == AltitudeReference::STD);
ok1(equals(airspace.GetTop().flight_level, 65));
} else if (StringIsEqual(_T("Height-Test-3"), airspace.GetName())) {
ok1(airspace.GetBase().reference == AltitudeReference::AGL);
ok1(equals(airspace.GetBase().altitude_above_terrain,
Units::ToSysUnit(100, Unit::FEET)));
ok1(airspace.GetTop().reference == AltitudeReference::MSL);
ok1(airspace.GetTop().altitude > Units::ToSysUnit(30000, Unit::FEET));
} else if (StringIsEqual(_T("Height-Test-4"), airspace.GetName())) {
ok1(airspace.GetBase().reference == AltitudeReference::MSL);
ok1(equals(airspace.GetBase().altitude, 100));
ok1(airspace.GetTop().reference == AltitudeReference::MSL);
ok1(airspace.GetTop().altitude > Units::ToSysUnit(30000, Unit::FEET));
} else if (StringIsEqual(_T("Height-Test-5"), airspace.GetName())) {
ok1(airspace.GetBase().reference == AltitudeReference::AGL);
ok1(equals(airspace.GetBase().altitude, 100));
ok1(airspace.GetTop().reference == AltitudeReference::MSL);
ok1(equals(airspace.GetTop().altitude, 450));
} else if (StringIsEqual(_T("Height-Test-6"), airspace.GetName())) {
ok1(airspace.GetBase().reference == AltitudeReference::AGL);
ok1(equals(airspace.GetBase().altitude_above_terrain,
Units::ToSysUnit(50, Unit::FEET)));
ok1(airspace.GetTop().reference == AltitudeReference::STD);
ok1(equals(airspace.GetTop().flight_level, 50));
} else {
//.........这里部分代码省略.........