Example #1
0
void
StatusMessageList::LoadFile()
{
  std::unique_ptr<TLineReader> reader(OpenConfiguredTextFile(ProfileKeys::StatusFile));
  if (reader)
    LoadFile(*reader);
}
void
WaypointDetails::ReadFileFromProfile(Waypoints &way_points,
                                     OperationEnvironment &operation)
{
  std::unique_ptr<TLineReader>
  reader(OpenConfiguredTextFile(ProfileKeys::AirfieldFile, _T("airfields.txt"),
                                ConvertLineReader::AUTO));
  if (reader)
    ReadFile(*reader, way_points, operation);
}
void
ReadAirspace(Airspaces &airspaces,
             RasterTerrain *terrain,
             const AtmosphericPressure &press,
             OperationEnvironment &operation)
{
  LogStartUp(_T("ReadAirspace"));
  operation.SetText(_("Loading Airspace File..."));

  bool airspace_ok = false;

  // Read the airspace filenames from the registry
  TLineReader *reader =
    OpenConfiguredTextFile(szProfileAirspaceFile, _T("airspace.txt"));
  if (reader != NULL) {
    if (!ReadAirspace(airspaces, *reader, operation))
      LogStartUp(_T("No airspace file 1"));
    else
      airspace_ok =  true;

    delete reader;
  }

  reader = OpenConfiguredTextFile(szProfileAdditionalAirspaceFile);
  if (reader != NULL) {
    if (!ReadAirspace(airspaces, *reader, operation))
      LogStartUp(_T("No airspace file 2"));
    else
      airspace_ok = true;

    delete reader;
  }

  if (airspace_ok) {
    airspaces.optimise();
    airspaces.set_flight_levels(press);

    if (terrain != NULL)
      airspaces.set_ground_levels(*terrain);
  } else
    // there was a problem
    airspaces.clear();
}
Example #4
0
void
StatusMessageList::LoadFile()
{
  LogStartUp(_T("Loading status file"));

  TLineReader *reader = OpenConfiguredTextFile(szProfileStatusFile);
  if (reader != NULL) {
    LoadFile(*reader);
    delete reader;
  }
}
Example #5
0
static bool
ReadPolarFileFromProfile(PolarInfo &polar)
{
  TLineReader *reader = OpenConfiguredTextFile(szProfilePolarFile);
  if (reader == NULL)
    return false;

  bool success = PolarGlue::LoadFromFile(polar, *reader);
  delete reader;

  return success;
}
Example #6
0
TLineReader *
OpenConfiguredTextFile(const char *profile_key, const char *in_map_file,
                       Charset cs)
{
  assert(profile_key != nullptr);
  assert(in_map_file != nullptr);

  TLineReader *reader = OpenConfiguredTextFile(profile_key, cs);
  if (reader == nullptr)
    reader = OpenMapTextFile(in_map_file, cs);

  return reader;
}
static void
LoadFiles(Airspaces &airspace_database)
{
  NullOperationEnvironment operation;

  std::unique_ptr<TLineReader> reader(OpenConfiguredTextFile(ProfileKeys::AirspaceFile,
                                                             Charset::AUTO));
  if (reader) {
    AirspaceParser parser(airspace_database);
    parser.Parse(*reader, operation);
    airspace_database.Optimise();
  }
}
Example #8
0
TLineReader *
OpenConfiguredTextFile(const char *profile_key, const TCHAR *in_map_file,
                       ConvertLineReader::charset cs)
{
  assert(profile_key != NULL);
  assert(in_map_file != NULL);

  TLineReader *reader = OpenConfiguredTextFile(profile_key, cs);
  if (reader == NULL)
    reader = OpenMapTextFile(in_map_file, cs);

  return reader;
}
Example #9
0
std::unique_ptr<TLineReader>
OpenConfiguredTextFile(const char *profile_key, const char *in_map_file,
                       Charset cs)
{
    assert(profile_key != nullptr);
    assert(in_map_file != nullptr);

    auto reader = OpenConfiguredTextFile(profile_key, cs);
    if (!reader)
        reader = OpenMapTextFile(in_map_file, cs);

    return reader;
}
Example #10
0
static void
LoadFiles(Airspaces &airspace_database)
{
  NullOperationEnvironment operation;

  TLineReader *reader = OpenConfiguredTextFile(szProfileAirspaceFile);
  if (reader != NULL) {
    AirspaceParser parser(airspace_database);
    parser.Parse(*reader, operation);
    delete reader;

    airspace_database.optimise();
  }
}
Example #11
0
// Read the data files
void
InputEvents::readFile()
{
  LogStartUp(_T("Loading input events file"));

  // clear the GCE and NMEA queues
  ClearQueues();

  LoadDefaults(input_config);

  // Read in user defined configuration file
  std::unique_ptr<TLineReader> reader(OpenConfiguredTextFile(szProfileInputFile));
  if (reader)
    ::ParseInputFile(input_config, *reader);
}
Example #12
0
/**
 * Opens the airfield details file and parses it
 */
void
ReadAirfieldFile(Waypoints &way_points)
{
  LogStartUp(_T("ReadAirfieldFile"));

  TLineReader *reader =
    OpenConfiguredTextFile(szProfileAirfieldFile, _T("airfields.txt"));
  if (reader == NULL)
    return;

  ProgressGlue::Create(_("Loading Airfield Details File..."));

  ParseAirfieldDetails(way_points, *reader);
  delete reader;
}
Example #13
0
void
WaypointDetails::ReadFileFromProfile(Waypoints &way_points,
                                     OperationEnvironment &operation)
{
  LogStartUp(_T("WaypointDetails::ReadFileFromProfile"));

  TLineReader *reader =
    OpenConfiguredTextFile(szProfileAirfieldFile, _T("airfields.txt"),
                           ConvertLineReader::AUTO);
  if (reader == NULL)
    return;

  ReadFile(*reader, way_points, operation);
  delete reader;
}
Example #14
0
static void
LoadFiles(ComputerSettings &settings)
{
  NullOperationEnvironment operation;

  topography = new TopographyStore();
  LoadConfiguredTopography(*topography, operation);

  terrain = RasterTerrain::OpenTerrain(NULL, operation);

  WaypointGlue::LoadWaypoints(way_points, terrain, operation);
  WaypointGlue::SetHome(way_points, terrain, settings, NULL, false);

  std::unique_ptr<TLineReader> reader(OpenConfiguredTextFile(ProfileKeys::AirspaceFile,
                                                             ConvertLineReader::AUTO));
  if (reader) {
    AirspaceParser parser(airspace_database);
    parser.Parse(*reader, operation);
    airspace_database.Optimise();
  }
}