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

Method GetDistanceAndAzimut

libs/map/framework.cpp:1468–1495  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1466}
1467
1468bool Framework::GetDistanceAndAzimut(m2::PointD const & point, double lat, double lon, double north,
1469 platform::Distance & distance, double & azimut)
1470{
1471#ifdef FIXED_LOCATION
1472 m_fixedPos.GetLat(lat);
1473 m_fixedPos.GetLon(lon);
1474 m_fixedPos.GetNorth(north);
1475#endif
1476
1477 double const d = ms::DistanceOnEarth(lat, lon, mercator::YToLat(point.y), mercator::XToLon(point.x));
1478
1479 // Distance may be less than 1.0
1480 distance = platform::Distance::CreateFormatted(d);
1481
1482 // We calculate azimuth even when distance is very short (d ~ 0),
1483 // because return value has 2 states (near me or far from me).
1484
1485 azimut = ang::Azimuth(mercator::FromLatLon(lat, lon), point, north);
1486
1487 double const pi2 = 2.0 * math::pi;
1488 if (azimut < 0.0)
1489 azimut += pi2;
1490 else if (azimut > pi2)
1491 azimut -= pi2;
1492
1493 // This constant and return value is using for arrow/flag choice.
1494 return (d < 25000.0);
1495}
1496
1497void Framework::CreateDrapeEngine(ref_ptr<dp::GraphicsContextFactory> contextFactory, DrapeCreationParams && params)
1498{

Calls 8

YToLatFunction · 0.85
XToLonFunction · 0.85
AzimuthFunction · 0.85
GetLatMethod · 0.80
GetLonMethod · 0.80
GetNorthMethod · 0.80
DistanceOnEarthFunction · 0.50
FromLatLonFunction · 0.50

Tested by

no test coverage detected