Esempio n. 1
0
int main(int argc, char **argv)
{
  Args args(argc, argv, "PATH");
  const char *map_path = args.ExpectNext();
  args.ExpectEnd();

  char jp2_path[4096];
  strcpy(jp2_path, map_path);
  strcat(jp2_path, DIR_SEPARATOR_S "terrain.jp2");

  TCHAR j2w_path[4096];
  _tcscpy(j2w_path, PathName(map_path));
  _tcscat(j2w_path, _T(DIR_SEPARATOR_S) _T("terrain.j2w"));

  NullOperationEnvironment operation;
  RasterTileCache rtc;
  if (!rtc.LoadOverview(jp2_path, j2w_path, operation)) {
    fprintf(stderr, "LoadOverview failed\n");
    return EXIT_FAILURE;
  }

  GeoBounds bounds = rtc.GetBounds();
  printf("bounds = %f|%f - %f|%f\n",
         (double)bounds.GetWest().Degrees(),
         (double)bounds.GetNorth().Degrees(),
         (double)bounds.GetEast().Degrees(),
         (double)bounds.GetSouth().Degrees());

  do {
    rtc.UpdateTiles(jp2_path, rtc.GetWidth() / 2, rtc.GetHeight() / 2,
                    1000);
  } while (rtc.IsDirty());

  return EXIT_SUCCESS;
}
Esempio n. 2
0
int main(int argc, char **argv)
{
  Args args(argc, argv, "PATH");
  const auto map_path = args.ExpectNext();
  args.ExpectEnd();

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

  NullOperationEnvironment operation;
  RasterTileCache rtc;
  if (!LoadTerrainOverview(dir, rtc, operation)) {
    fprintf(stderr, "LoadOverview failed\n");
    zzip_dir_close(dir);
    return EXIT_FAILURE;
  }

  GeoBounds bounds = rtc.GetBounds();
  printf("bounds = %f|%f - %f|%f\n",
         (double)bounds.GetWest().Degrees(),
         (double)bounds.GetNorth().Degrees(),
         (double)bounds.GetEast().Degrees(),
         (double)bounds.GetSouth().Degrees());

  SharedMutex mutex;
  do {
    UpdateTerrainTiles(dir, rtc, mutex,
                       rtc.GetWidth() / 2, rtc.GetHeight() / 2, 1000);
  } while (rtc.IsDirty());
  zzip_dir_close(dir);

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

  const char *map_path = argv[1];

  char jp2_path[4096];
  strcpy(jp2_path, map_path);
  strcat(jp2_path, DIR_SEPARATOR_S "terrain.jp2");

  TCHAR j2w_path[4096];
  _tcscpy(j2w_path, PathName(map_path));
  _tcscat(j2w_path, _T(DIR_SEPARATOR_S) _T("terrain.j2w"));

  NullOperationEnvironment operation;
  RasterTileCache rtc;
  if (!rtc.LoadOverview(jp2_path, j2w_path, operation)) {
    fprintf(stderr, "LoadOverview failed\n");
    return EXIT_FAILURE;
  }

  GeoBounds bounds = rtc.GetBounds();
  printf("bounds = %f|%f - %f|%f\n",
         (double)bounds.west.value_degrees(),
         (double)bounds.north.value_degrees(),
         (double)bounds.east.value_degrees(),
         (double)bounds.south.value_degrees());

  do {
    rtc.UpdateTiles(jp2_path, rtc.GetWidth() / 2, rtc.GetHeight() / 2,
                    fixed(50000));
  } while (rtc.IsDirty());

  return EXIT_SUCCESS;
}
Esempio n. 4
0
 gcc_pure
 bool inside(const GeoPoint &pt) const {
   return raster_tile_cache.GetBounds().IsInside(pt);
 }
Esempio n. 5
0
 bool isMapLoaded() const {
   return raster_tile_cache.GetInitialised();
 }
Esempio n. 6
0
 const GeoBounds &GetBounds() const {
   return raster_tile_cache.GetBounds();
 }
Esempio n. 7
0
 bool jas_rtc_PollTiles(int view_x, int view_y) {
   return jas_rtc.PollTiles(view_x, view_y);
 }
Esempio n. 8
0
 const Serial &GetSerial() const {
   return raster_tile_cache.GetSerial();
 }
Esempio n. 9
0
 void jas_rtc_SetTile(int index, int xstart, int ystart, int xend, int yend) {
   jas_rtc.SetTile(index, xstart, ystart, xend, yend);
 }
Esempio n. 10
0
 bool jas_rtc_GetInitialised(void) {
   return jas_rtc.GetInitialised();
 }
Esempio n. 11
0
 void jas_rtc_SetInitialised(bool val) {
   jas_rtc.SetInitialised(val);
 }
Esempio n. 12
0
 void jas_rtc_SetSize(int width, int height) {
   jas_rtc.SetSize(width, height);
 }
Esempio n. 13
0
 void jas_rtc_SetLatLonBounds(double lon_min, double lon_max, double lat_min, double lat_max) {
   jas_rtc.SetLatLonBounds(lon_min, lon_max, lat_min, lat_max);
 }
Esempio n. 14
0
 short* jas_rtc_GetImageBuffer(int index) {
   return jas_rtc.GetImageBuffer(index);
 }
Esempio n. 15
0
 gcc_pure
 GeoPoint GetMapCenter() const {
   return raster_tile_cache.GetBounds().GetCenter();
 }
Esempio n. 16
0
 /**
  * Determines if SetViewCenter() should be called again to continue
  * loading.
  */
 gcc_pure
 bool IsDirty() const {
   return raster_tile_cache.IsDirty();
 }
Esempio n. 17
0
 bool SaveCache(FILE *file) const {
   return raster_tile_cache.SaveCache(file);
 }
Esempio n. 18
0
 bool IsDefined() const {
   return raster_tile_cache.IsValid();
 }
Esempio n. 19
0
 bool jas_rtc_TileRequest(int index) {
   return jas_rtc.TileRequest(index);
 }