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

Function LonToInt

libs/ge0/url_generator.cpp:176–180  ·  view source on GitHub ↗

Map longitude: [-180, 180) -> [0, maxValue]

Source from the content-addressed store, hash-verified

174
175// Map longitude: [-180, 180) -> [0, maxValue]
176int LonToInt(double lon, int maxValue)
177{
178 double const x = (LonIn180180(lon) + 180.0) / 360.0 * (maxValue + 1.0) + 0.5;
179 return (x <= 0 || x >= maxValue + 1) ? 0 : static_cast<int>(x);
180}
181
182void LatLonToString(double lat, double lon, char * s, size_t nBytes)
183{

Callers 2

LatLonToStringFunction · 0.85
UNIT_TESTFunction · 0.85

Calls 1

LonIn180180Function · 0.85

Tested by 1

UNIT_TESTFunction · 0.68