Program Listing for File GdalSource.hpp
↰ Return to documentation for file (optional/gdal/src/navtk/geospatial/sources/GdalSource.hpp)
#pragma once
#include <memory>
#include <utility>
#include <navtk/geospatial/Tile.hpp>
#include <navtk/geospatial/sources/ElevationSource.hpp>
#include <navtk/not_null.hpp>
namespace navtk {
namespace geospatial {
class GdalSource : public ElevationSource {
public:
enum class MapType {
GEOTIFF,
DTED
};
GdalSource(const std::string& map_path,
MapType type,
AspnMeasurementAltitudeReference in_ref = ASPN_MEASUREMENT_ALTITUDE_REFERENCE_HAE,
AspnMeasurementAltitudeReference out_ref = ASPN_MEASUREMENT_ALTITUDE_REFERENCE_HAE,
unsigned int num_tiles = 10,
const std::string& undulation_path = "WW15MGH.GRD");
std::pair<bool, double> lookup_datum(double latitude, double longitude) const override;
Vector lookup_data(const Vector& latitudes, const Vector& longitudes) const;
void set_output_vertical_reference_frame(AspnMeasurementAltitudeReference new_ref) override;
Coordinate wgs84_to_map(double latitude, double longitude) const;
Coordinates wgs84_to_map(const Vector& latitudes, const Vector& longitudes_rad) const;
bool is_stored(const std::string& filename) const;
size_t get_cached_num() const;
size_t get_size() const;
private:
void find_tiles(const std::string& map_path);
void add_tile(const std::string& filename);
bool is_valid_tile(const Tile& tile) const;
void mark_tile_as_cached(const std::vector<size_t>::iterator& iter) const;
std::vector<Tile> tiles;
mutable std::vector<size_t> search_order;
size_t max_size;
GdalSource(const GdalSource&) = delete;
GdalSource& operator=(const GdalSource&) = delete;
std::unique_ptr<OGRCoordinateTransformation, detail::TransformDelete> wgs84_to_map_transform =
nullptr;
bool need_transform = true;
const MapType map_type;
std::string undulation_path;
};
} // namespace geospatial
} // namespace navtk