MCPcopy Create free account
hub / github.com/comaps/comaps / GetValueImpl

Method GetValueImpl

tools/topography_generator/generator.cpp:96–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94
95private:
96 Altitude GetValueImpl(ms::LatLon pos)
97 {
98 if (m_preferredTile != nullptr)
99 {
100 using mercator::kPointEqualityEps;
101
102 // Each SRTM tile overlaps the top row in the bottom tile and the right row in the left tile.
103 // Try to prevent loading a new tile if the position can be found in the loaded one.
104 auto const latDist = pos.m_lat - m_leftBottomOfPreferredTile.m_lat;
105 auto const lonDist = pos.m_lon - m_leftBottomOfPreferredTile.m_lon;
106 if (latDist > -kPointEqualityEps && latDist < 1.0 + kPointEqualityEps && lonDist > -kPointEqualityEps &&
107 lonDist < 1.0 + kPointEqualityEps)
108 {
109 if (latDist < 0.0)
110 pos.m_lat += kPointEqualityEps;
111 else if (latDist >= 1.0)
112 pos.m_lat -= kPointEqualityEps;
113 if (lonDist < 0.0)
114 pos.m_lon += kPointEqualityEps;
115 else if (lonDist >= 1.0)
116 pos.m_lon -= kPointEqualityEps;
117
118 return m_preferredTile->GetAltitude(pos);
119 }
120 }
121
122 return m_srtmManager.GetAltitude(pos);
123 }
124
125 Altitude GetMedianValue(ms::LatLon const & pos)
126 {

Callers

nothing calls this directly

Calls 1

GetAltitudeMethod · 0.45

Tested by

no test coverage detected