Exemple #1
0
int main(int argc, char **argv)
{
  Args args(argc, argv, "PATH");
  const char *path = args.ExpectNext();
  args.ExpectEnd();

  ZZIP_DIR *dir = zzip_dir_open(path, NULL);
  if (dir == NULL) {
    fprintf(stderr, "Failed to open %s\n", (const char *)path);
    return EXIT_FAILURE;
  }

  ZipLineReaderA reader(dir, "topology.tpl");
  if (reader.error()) {
    fprintf(stderr, "Failed to open %s\n", (const char *)path);
    return EXIT_FAILURE;
  }

  TopographyStore topography;
  NullOperationEnvironment operation;
  topography.Load(operation, reader, NULL, dir);
  zzip_dir_close(dir);

  topography.LoadAll();

#ifdef ENABLE_OPENGL
  TriangulateAll(topography);
#endif

  return EXIT_SUCCESS;
}
Exemple #2
0
int main(int argc, char **argv)
{
    if (argc != 2) {
        fprintf(stderr, "Usage: %s PATH\n", argv[0]);
        return 1;
    }

    const char *path = argv[1];

    ZZIP_DIR *dir = zzip_dir_open(path, NULL);
    if (dir == NULL) {
        fprintf(stderr, "Failed to open %s\n", (const char *)path);
        return EXIT_FAILURE;
    }

    ZipLineReaderA reader(dir, "topology.tpl");
    if (reader.error()) {
        fprintf(stderr, "Failed to open %s\n", (const char *)path);
        return EXIT_FAILURE;
    }

    TopographyStore topography;
    NullOperationEnvironment operation;
    topography.Load(operation, reader, NULL, dir);
    zzip_dir_close(dir);

    TestProjection projection;

    topography.ScanVisibility(projection);

    return EXIT_SUCCESS;
}
/**
 * Load topography from the map file (ZIP), load the other files from
 * the same ZIP file.
 */
static bool
LoadConfiguredTopographyZip(TopographyStore &store,
                            OperationEnvironment &operation)
try {
  auto archive = OpenMapFile();
  if (!archive)
    return false;

  ZipLineReaderA reader(archive->get(), "topology.tpl");
  store.Load(operation, reader, nullptr, archive->get());
  return true;
} catch (...) {
  LogError(std::current_exception(), "No topography in map file");
  return false;
}
/**
 * Load topography from the map file (ZIP), load the other files from
 * the same ZIP file.
 */
static bool
LoadConfiguredTopographyZip(TopographyStore &store,
                            OperationEnvironment &operation)
{
  auto dir = OpenMapFile();
  if (dir == nullptr)
    return false;

  ZipLineReaderA reader(dir, "topology.tpl", IgnoreError());
  if (reader.error()) {
    zzip_dir_close(dir);
    LogFormat(_T("No topography in map file"));
    return false;
  }

  store.Load(operation, reader, nullptr, dir);
  zzip_dir_close(dir);
  return true;
}
Exemple #5
0
/**
 * Load topography from the map file (ZIP), load the other files from
 * the same ZIP file.
 */
static bool
LoadConfiguredTopographyZip(TopographyStore &store,
                            OperationEnvironment &operation)
{
  TCHAR path[MAX_PATH];
  if (!Profile::GetPath(szProfileMapFile, path))
    return false;

  ZZIP_DIR *dir = zzip_dir_open(NarrowPathName(path), NULL);
  if (dir == NULL)
    return false;

  ZipLineReaderA reader(dir, "topology.tpl");
  if (reader.error()) {
    LogStartUp(_T("No topography in map file: %s"), path);
    return false;
  }

  store.Load(operation, reader, NULL, dir);
  zzip_dir_close(dir);
  return true;
}
Exemple #6
0
/**
 * Load topography from a plain file, load the other files from the same
 * directory.
 */
static bool
LoadConfiguredTopographyFile(TopographyStore &store,
                             OperationEnvironment &operation)
{
  TCHAR file[MAX_PATH];
  if (!Profile::GetPath(szProfileTopographyFile, file))
    return false;

  FileLineReaderA reader(file);
  if (reader.error()) {
    LogStartUp(_T("No topography file: %s"), file);
    return false;
  }

  TCHAR buffer[MAX_PATH];
  const TCHAR *directory = DirName(file, buffer);
  if (directory == NULL)
    return false;

  store.Load(operation, reader, directory);
  return true;
}