LazMapViewer: Extend TRealPoint with methods to convert from/to radians. Issue #38279, patch by regs.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7946 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2020-12-30 09:28:31 +00:00
parent 042fb0fcc2
commit 9d506bfa25

View File

@@ -10,11 +10,12 @@
unit mvTypes; unit mvTypes;
{$mode objfpc}{$H+} {$mode objfpc}{$H+}
{$MODESWITCH ADVANCEDRECORDS}
interface interface
uses uses
Classes, SysUtils; Classes, SysUtils, Math;
const const
TILE_SIZE = 256; TILE_SIZE = 256;
@@ -28,8 +29,17 @@ Type
{ TRealPoint } { TRealPoint }
TRealPoint = Record TRealPoint = Record
Lon : Double; public
Lat : Double; Lon: Double;
Lat: Double;
private
function GetLonRad: Extended;
procedure SetLonRad(AValue: Extended);
function GetLatRad: Extended;
procedure SetLatRad(AValue: Extended);
public
property LonRad: Extended read GetLonRad write SetLonRad;
property LatRad: Extended read GetLatRad write SetLatRad;
end; end;
{ TRealArea } { TRealArea }
@@ -40,5 +50,25 @@ Type
implementation implementation
function TRealPoint.GetLonRad: Extended;
begin
Result := DegToRad(Self.Lon);
end;
procedure TRealPoint.SetLonRad(AValue: Extended);
begin
Self.Lon := RadToDeg(AValue);
end;
function TRealPoint.GetLatRad: Extended;
begin
Result := DegToRad(Self.Lat);
end;
procedure TRealPoint.SetLatRad(AValue: Extended);
begin
Self.Lat := RadToDeg(AValue);
end;
end. end.