MCPcopy Create free account
hub / github.com/Project-OSRM/osrm-backend / GetRasterInterpolateFromSource

Method GetRasterInterpolateFromSource

src/extractor/raster_source.cpp:147–167  ·  view source on GitHub ↗

External function for looking up interpolated data from a specified source

Source from the content-addressed store, hash-verified

145
146// External function for looking up interpolated data from a specified source
147RasterDatum
148RasterContainer::GetRasterInterpolateFromSource(unsigned int source_id, double lon, double lat)
149{
150 if (RasterCache::getInstance().getLoadedSources().size() < source_id + 1)
151 {
152 throw util::exception("Attempted to access source " + std::to_string(source_id) +
153 ", but there are only " +
154 std::to_string(RasterCache::getInstance().getLoadedSources().size()) +
155 " loaded" + SOURCE_REF);
156 }
157
158 BOOST_ASSERT(lat < 90);
159 BOOST_ASSERT(lat > -90);
160 BOOST_ASSERT(lon < 180);
161 BOOST_ASSERT(lon > -180);
162
163 const auto &found = RasterCache::getInstance().getLoadedSources()[source_id];
164 return found.GetRasterInterpolate(
165 static_cast<std::int32_t>(util::toFixed(util::FloatLongitude{lon})),
166 static_cast<std::int32_t>(util::toFixed(util::FloatLatitude{lat})));
167}
168
169RasterCache *RasterCache::g_instance = NULL;
170} // namespace osrm::extractor

Callers

nothing calls this directly

Calls 5

exceptionClass · 0.85
to_stringFunction · 0.85
toFixedFunction · 0.85
GetRasterInterpolateMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected