String Utils::GetRelativeLocationFromCoordinates(const Coordinates &myCoords, const Coordinates &theirCoords) { String distString; if (&theirCoords == null) return L"None"; else { if (&myCoords == null) { // If we don't have our co-ordinates we just return their absolute co-ordinates. double latitude = 0, longitude = 0; latitude = theirCoords.GetLatitude(); if (latitude >= 0) distString.Format(10, L"N %.2f ", latitude); else distString.Format(10, L"S %.2f ", -1 * latitude); String tmpStr; longitude = theirCoords.GetLongitude(); if (longitude >= 0) tmpStr.Format(10, L"W %.2f", longitude); else tmpStr.Format(10, L"E %.2f", -1 * longitude); distString.Append(tmpStr); return distString; } else { float distance = myCoords.Distance(theirCoords); if (distance > 1000) { distance /= 1000; distString.Format(20, L"%.1fkm", distance); } else distString.Format(20, L"%3.0fm", distance); return distString; } } }