External function for looking up nearest data point from a specified source
| 124 | |
| 125 | // External function for looking up nearest data point from a specified source |
| 126 | RasterDatum RasterContainer::GetRasterDataFromSource(unsigned int source_id, double lon, double lat) |
| 127 | { |
| 128 | if (RasterCache::getInstance().getLoadedSources().size() < source_id + 1) |
| 129 | { |
| 130 | throw util::exception("Attempted to access source " + std::to_string(source_id) + |
| 131 | ", but there are only " + |
| 132 | std::to_string(RasterCache::getInstance().getLoadedSources().size()) + |
| 133 | " loaded" + SOURCE_REF); |
| 134 | } |
| 135 | |
| 136 | BOOST_ASSERT(lat < 90); |
| 137 | BOOST_ASSERT(lat > -90); |
| 138 | BOOST_ASSERT(lon < 180); |
| 139 | BOOST_ASSERT(lon > -180); |
| 140 | |
| 141 | const auto &found = RasterCache::getInstance().getLoadedSources()[source_id]; |
| 142 | return found.GetRasterData(static_cast<std::int32_t>(util::toFixed(util::FloatLongitude{lon})), |
| 143 | static_cast<std::int32_t>(util::toFixed(util::FloatLatitude{lat}))); |
| 144 | } |
| 145 | |
| 146 | // External function for looking up interpolated data from a specified source |
| 147 | RasterDatum |
no test coverage detected