コード例 #1
0
ファイル: harness_airspace.cpp プロジェクト: kwtskran/XCSoar
bool test_airspace_extra(Airspaces &airspaces) {
    // try adding a null polygon

    AbstractAirspace* as;
    std::vector<GeoPoint> pts;
    as = new AirspacePolygon(pts);
    airspaces.Add(as);

    // try clearing now (we haven't called optimise())

    airspaces.Clear();
    return true;
}
コード例 #2
0
ファイル: AirspaceGlue.cpp プロジェクト: staylo/XCSoar
void
ReadAirspace(Airspaces &airspaces,
             RasterTerrain *terrain,
             const AtmosphericPressure &press,
             OperationEnvironment &operation)
{
    LogFormat("ReadAirspace");
    operation.SetText(_("Loading Airspace File..."));

    bool airspace_ok = false;

    AirspaceParser parser(airspaces);

    // Read the airspace filenames from the registry
    auto path = Profile::GetPath(ProfileKeys::AirspaceFile);
    if (!path.IsNull())
        airspace_ok |= ParseAirspaceFile(parser, path, operation);

    path = Profile::GetPath(ProfileKeys::AdditionalAirspaceFile);
    if (!path.IsNull())
        airspace_ok |= ParseAirspaceFile(parser, path, operation);

    auto archive = OpenMapFile();
    if (archive)
        airspace_ok |= ParseAirspaceFile(parser, archive->get(), "airspace.txt",
                                         operation);

    if (airspace_ok) {
        airspaces.Optimise();
        airspaces.SetFlightLevels(press);

        if (terrain != NULL)
            airspaces.SetGroundLevels(*terrain);
    } else
        // there was a problem
        airspaces.Clear();
}