You've already forked lazarus-ccr
MapViewer: misc updates
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7971 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -10,7 +10,7 @@ object MainForm: TMainForm
|
||||
OnDestroy = FormDestroy
|
||||
OnShow = FormShow
|
||||
ShowHint = True
|
||||
LCLVersion = '2.0.6.0'
|
||||
LCLVersion = '2.1.0.0'
|
||||
object MapView: TMapView
|
||||
Left = 0
|
||||
Height = 640
|
||||
@ -39,9 +39,9 @@ object MainForm: TMainForm
|
||||
Height = 640
|
||||
Top = 0
|
||||
Width = 275
|
||||
ActivePage = PgConfig
|
||||
ActivePage = PgData
|
||||
Align = alRight
|
||||
TabIndex = 1
|
||||
TabIndex = 0
|
||||
TabOrder = 1
|
||||
object PgData: TTabSheet
|
||||
Caption = 'Data'
|
||||
@ -824,19 +824,19 @@ object MainForm: TMainForm
|
||||
end
|
||||
object GeoNames: TMVGeoNames
|
||||
OnNameFound = GeoNamesNameFound
|
||||
left = 240
|
||||
top = 192
|
||||
Left = 240
|
||||
Top = 192
|
||||
end
|
||||
object OpenDialog: TOpenDialog
|
||||
DefaultExt = '.pgx'
|
||||
Filter = 'GPX files (*.gpx)|*.gpx|All files (*.*)|*.*'
|
||||
left = 240
|
||||
top = 456
|
||||
Left = 240
|
||||
Top = 456
|
||||
end
|
||||
object FontDialog: TFontDialog
|
||||
MinFontSize = 0
|
||||
MaxFontSize = 0
|
||||
left = 808
|
||||
top = 104
|
||||
Left = 808
|
||||
Top = 104
|
||||
end
|
||||
end
|
||||
|
@ -73,6 +73,7 @@ begin
|
||||
InitSSLInterface;
|
||||
http := TFpHttpClient.Create(nil);
|
||||
try
|
||||
http.ConnectTimeOut := 10000;
|
||||
{$IF FPC_FullVersion >= 30000}
|
||||
http.AllowRedirect := true;
|
||||
{$IFEND}
|
||||
|
@ -164,6 +164,8 @@ type
|
||||
property OnZoomChange: TNotifyEvent read FOnZoomChange write FOnZoomChange;
|
||||
end;
|
||||
|
||||
function RealPoint(Lat, Lon: Double): TRealPoint;
|
||||
|
||||
function CalcGeoDistance(Lat1, Lon1, Lat2, Lon2: double;
|
||||
AUnits: TDistanceUnits = duKilometers): double;
|
||||
|
||||
@ -661,7 +663,6 @@ begin
|
||||
Result.y := Round(py);
|
||||
end;
|
||||
|
||||
|
||||
function TMapViewerEngine.LonLatToScreen(ALonLat: TRealPoint): TPoint;
|
||||
Begin
|
||||
Result := DegreesToMapPixels(MapWin, ALonLat);
|
||||
@ -1086,7 +1087,8 @@ procedure TMapViewerEngine.SetActive(AValue: boolean);
|
||||
begin
|
||||
if FActive = AValue then Exit;
|
||||
FActive := AValue;
|
||||
if not(FActive) then
|
||||
|
||||
if not FActive then
|
||||
Queue.CancelAllJob(self)
|
||||
else begin
|
||||
if Cache.UseDisk then ForceDirectories(Cache.BasePath);
|
||||
@ -1279,6 +1281,12 @@ end;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function RealPoint(Lat, Lon: Double): TRealPoint;
|
||||
begin
|
||||
Result.Lon := Lon;
|
||||
Result.Lat := Lat;
|
||||
end;
|
||||
|
||||
procedure SplitGps(AValue: Double; out ADegs, AMins: Double);
|
||||
begin
|
||||
AValue := abs(AValue);
|
||||
|
@ -53,22 +53,24 @@ type
|
||||
TGPSPoint = class(TGPSObj)
|
||||
private
|
||||
FRealPt: TRealPoint;
|
||||
FEle: Double;
|
||||
FElevation: Double;
|
||||
FDateTime: TDateTime;
|
||||
function GetLat: Double;
|
||||
function GetLon: Double;
|
||||
public
|
||||
constructor Create(ALon,ALat: double; AEle: double=NO_ELE; ADateTime: TDateTime=NO_DATE);
|
||||
class function CreateFrom(aPt: TRealPoint): TGPSPoint;
|
||||
constructor Create(ALon,ALat: double; AElevation: double = NO_ELE;
|
||||
ADateTime: TDateTime = NO_DATE);
|
||||
class function CreateFrom(aPt: TRealPoint; AElevation: Double = NO_ELE;
|
||||
ADateTime: TDateTime = NO_DATE): TGPSPoint;
|
||||
|
||||
procedure GetArea(out Area: TRealArea);override;
|
||||
function HasEle: boolean;
|
||||
function HasElevation: boolean;
|
||||
function HasDateTime: Boolean;
|
||||
function DistanceInKmFrom(OtherPt: TGPSPoint; UseEle: boolean=true): double;
|
||||
function DistanceInKmFrom(OtherPt: TGPSPoint; UseElevation: boolean=true): double;
|
||||
|
||||
property Lon: Double read GetLon;
|
||||
property Lat: Double read GetLat;
|
||||
property Ele: double read FEle;
|
||||
property Elevation: double read FElevation;
|
||||
property DateTime: TDateTime read FDateTime;
|
||||
property RealPoint: TRealPoint read FRealPt;
|
||||
end;
|
||||
@ -705,9 +707,9 @@ begin
|
||||
Area.BottomRight := FRealPt;
|
||||
end;
|
||||
|
||||
function TGPSPoint.HasEle: boolean;
|
||||
function TGPSPoint.HasElevation: boolean;
|
||||
begin
|
||||
Result := FEle <> NO_ELE;
|
||||
Result := FElevation <> NO_ELE;
|
||||
end;
|
||||
|
||||
function TGPSPoint.HasDateTime: Boolean;
|
||||
@ -715,7 +717,8 @@ begin
|
||||
Result := FDateTime <> NO_DATE;
|
||||
end;
|
||||
|
||||
function TGPSPoint.DistanceInKmFrom(OtherPt: TGPSPoint; UseEle: boolean): double;
|
||||
function TGPSPoint.DistanceInKmFrom(OtherPt: TGPSPoint;
|
||||
UseElevation: boolean = true): double;
|
||||
var
|
||||
a: double;
|
||||
lat1, lat2, lon1, lon2, t1, t2, t3, t4, t5, rad_dist: double;
|
||||
@ -734,27 +737,28 @@ begin
|
||||
t5 := t1 + t4;
|
||||
rad_dist := arctan(-t5/sqrt(-t5 * t5 +1)) + 2 * arctan(1);
|
||||
result := (rad_dist * 3437.74677 * 1.1508) * 1.6093470878864446;
|
||||
if UseEle and (FEle<>OtherPt.FEle) then
|
||||
if (HasEle) and (OtherPt.HasEle) then
|
||||
if UseElevation and (FElevation <> OtherPt.FElevation) then
|
||||
if (HasElevation) and (OtherPt.HasElevation) then
|
||||
begin
|
||||
//FEle is assumed in Metter
|
||||
DiffEle := (FEle-OtherPt.Ele)/1000;
|
||||
Result := sqrt(DiffEle*DiffEle+result*result);
|
||||
//FElevation is assumed in meters
|
||||
DiffEle := (FElevation - OtherPt.Elevation) / 1000;
|
||||
Result := sqrt(DiffEle*DiffEle + result*result);
|
||||
end;
|
||||
end;
|
||||
|
||||
constructor TGPSPoint.Create(ALon, ALat: double; AEle: double;
|
||||
constructor TGPSPoint.Create(ALon, ALat: double; AElevation: double;
|
||||
ADateTime: TDateTime);
|
||||
begin
|
||||
FRealPt.Lon := ALon;
|
||||
FRealPt.Lat := ALat;
|
||||
FEle := AEle;
|
||||
FElevation := AElevation;
|
||||
FDateTime := ADateTime;
|
||||
end;
|
||||
|
||||
class function TGPSPoint.CreateFrom(aPt: TRealPoint): TGPSPoint;
|
||||
class function TGPSPoint.CreateFrom(aPt: TRealPoint; AElevation: Double = NO_ELE;
|
||||
ADateTime: TDateTime = NO_DATE): TGPSPoint;
|
||||
begin
|
||||
Result := Create(aPt.Lon,aPt.Lat);
|
||||
Result := Create(aPt.Lon, aPt.Lat, AElevation, ADateTime);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -13,6 +13,8 @@
|
||||
See also: https://wiki.lazarus.freepascal.org/FPC_modified_LGPL
|
||||
}
|
||||
|
||||
// ToDo: Make Active work at designtime.
|
||||
|
||||
unit mvMapViewer;
|
||||
|
||||
{$MODE objfpc}{$H+}
|
||||
@ -144,7 +146,7 @@ Type
|
||||
property PopupMenu;
|
||||
property UseThreads: boolean read GetUseThreads write SetUseThreads default false;
|
||||
property Width default 150;
|
||||
property Zoom: integer read GetZoom write SetZoom;
|
||||
property Zoom: integer read GetZoom write SetZoom default 0;
|
||||
property ZoomToCursor: Boolean read GetZoomToCursor write SetZoomToCursor default True;
|
||||
property OnCenterMove: TNotifyEvent read GetOnCenterMove write SetOnCenterMove;
|
||||
property OnZoomChange: TNotifyEvent read GetOnZoomChange write SetOnZoomChange;
|
||||
|
Reference in New Issue
Block a user