private void addTileOrDescendands(MeshTile tile, List<MeshTile> tileList) {
    if (!tile.getSector().intersects(this.levelSet.getSector())) return;

    if (tile.getLevelNumber() == this.visibleLevel) {
      tileList.add(tile);
      return;
    }

    if (this.levelSet.isFinalLevel(tile.getLevelNumber())) {
      return;
    }

    MeshTile[] subTiles = tile.subdivide(this.levelSet.getLevel(tile.getLevelNumber() + 1));
    for (MeshTile subTile : subTiles) {
      addTileOrDescendands(subTile, tileList);
    }
  }
  private BufferWrapperRaster readTileRaster(MeshTile tile) {
    File file = new File(this.dataDescriptor.getFileStoreLocation(), tile.getPath());
    if (!file.exists()) return null;

    DataSource source = new BasicDataSource(file);
    source.setValue(AVKey.SECTOR, tile.getSector());

    BILRasterReader reader = new BILRasterReader();
    DataRaster[] rasters;
    try {
      rasters = reader.read(source);
    } catch (Exception e) {
      e.printStackTrace();
      return null;
    }

    return (BufferWrapperRaster) rasters[0];
  }
  private void drawTile(GL gl, Camera camera, MeshTile tile) {
    TileKey key = tile.getTileKey();

    ElevationMesh mesh = (ElevationMesh) this.cache.getObject(key);
    if (mesh == null && !this.cache.contains(key)) {
      BufferWrapperRaster raster = this.readTileRaster(tile);
      mesh = this.createMesh(tile, raster, this.verticalOffset, this.verticalScale);
      long size = (mesh != null) ? mesh.getSizeInBytes() : 1L;
      this.cache.add(key, mesh, size);
    }

    if (mesh != null) mesh.render(gl, camera);
  }
 private ElevationMesh createMesh(
     MeshTile tile, BufferWrapperRaster raster, double verticalOffset, double verticalScale) {
   if (raster == null) return null;
   return new ElevationMesh(raster, tile.getMeshCoords(), verticalOffset, verticalScale);
 }