lazmapviewer: Use E/W and N/S suffixes to GPS coordinates.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6868 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2019-04-25 19:42:50 +00:00
parent fb276886e4
commit efd629624c
5 changed files with 64 additions and 28 deletions

View File

@ -168,6 +168,9 @@ function CalcGeoDistance(Lat1, Lon1, Lat2, Lon2: double;
function GPSToDMS(Angle: Double): string;
function LatToStr(ALatitude: Double; DMS: Boolean): String;
function LonToStr(ALongitude: Double; DMS: Boolean): String;
procedure SplitGps(AValue: Double; out ADegs, AMins, ASecs: Double);
@ -1123,6 +1126,31 @@ begin
Result := Format('%.0f° %.0f'' %.1f"', [deg, min, sec]);
end;
function LatToStr(ALatitude: Double; DMS: Boolean): String;
begin
if DMS then
Result := GPSToDMS(abs(ALatitude))
else
Result := Format('%.6f°',[abs(ALatitude)]);
if ALatitude > 0 then
Result := Result + ' N'
else
if ALatitude < 0 then
Result := Result + 'E';
end;
function LonToStr(ALongitude: Double; DMS: Boolean): String;
begin
if DMS then
Result := GPSToDMS(abs(ALongitude))
else
Result := Format('%.6f°', [abs(ALongitude)]);
if ALongitude > 0 then
Result := Result + ' E'
else if ALongitude < 0 then
Result := Result + ' W';
end;
{ Returns the direct distance (air-line) between two geo coordinates
If latitude NOT between -90°..+90° and longitude NOT between -180°..+180°
the function returns -1.