From 6312921facfd345b8f53eef78cd061649ccb9b0b Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Thu, 19 Aug 2021 22:50:40 +0000 Subject: [PATCH] LazMapViewer: Add method TGpsPoint.MoveTo. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8077 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/lazmapviewer/example/main.lfm | 21 +-------------------- components/lazmapviewer/source/mvgpsobj.pas | 13 +++++++++++-- 2 files changed, 12 insertions(+), 22 deletions(-) diff --git a/components/lazmapviewer/example/main.lfm b/components/lazmapviewer/example/main.lfm index 05f484733..7a01c38eb 100644 --- a/components/lazmapviewer/example/main.lfm +++ b/components/lazmapviewer/example/main.lfm @@ -10,7 +10,7 @@ object MainForm: TMainForm OnDestroy = FormDestroy OnShow = FormShow ShowHint = True - LCLVersion = '2.1.0.0' + LCLVersion = '2.3.0.0' object MapView: TMapView Left = 0 Height = 640 @@ -26,7 +26,6 @@ object MainForm: TMainForm Font.Color = clBlack MapProvider = 'OpenStreetMap Mapnik' UseThreads = True - Zoom = 0 ZoomToCursor = False OnZoomChange = MapViewZoomChange OnChange = MapViewChange @@ -77,7 +76,6 @@ object MainForm: TMainForm BorderSpacing.Left = 6 BorderSpacing.Top = 6 Caption = 'Zoom:' - ParentColor = False end object CbMouseCoords: TGroupBox AnchorSideLeft.Control = PgData @@ -108,7 +106,6 @@ object MainForm: TMainForm BorderSpacing.Left = 8 BorderSpacing.Top = 4 Caption = 'Longitude' - ParentColor = False end object LblPositionLatitude: TLabel AnchorSideLeft.Control = CbMouseCoords @@ -122,7 +119,6 @@ object MainForm: TMainForm BorderSpacing.Top = 4 BorderSpacing.Bottom = 8 Caption = 'Latitude' - ParentColor = False end object InfoPositionLongitude: TLabel AnchorSideLeft.Control = CbMouseCoords @@ -138,7 +134,6 @@ object MainForm: TMainForm BorderSpacing.Top = 4 BorderSpacing.Right = 16 Caption = 'Label2' - ParentColor = False end object InfoPositionLatitude: TLabel AnchorSideLeft.Control = CbMouseCoords @@ -156,7 +151,6 @@ object MainForm: TMainForm BorderSpacing.Right = 16 BorderSpacing.Bottom = 8 Caption = 'Label2' - ParentColor = False end end object GbCenterCoords: TGroupBox @@ -186,7 +180,6 @@ object MainForm: TMainForm BorderSpacing.Left = 8 BorderSpacing.Top = 4 Caption = 'Longitude' - ParentColor = False end object LblCenterLatitude: TLabel AnchorSideLeft.Control = GbCenterCoords @@ -200,7 +193,6 @@ object MainForm: TMainForm BorderSpacing.Top = 4 BorderSpacing.Bottom = 8 Caption = 'Latitude' - ParentColor = False end object InfoCenterLongitude: TLabel AnchorSideLeft.Control = GbCenterCoords @@ -216,7 +208,6 @@ object MainForm: TMainForm BorderSpacing.Top = 4 BorderSpacing.Right = 16 Caption = 'Label2' - ParentColor = False end object InfoCenterLatitude: TLabel AnchorSideLeft.Control = GbCenterCoords @@ -234,7 +225,6 @@ object MainForm: TMainForm BorderSpacing.Right = 16 BorderSpacing.Bottom = 8 Caption = 'Label2' - ParentColor = False end end object GbScreenSize: TGroupBox @@ -264,7 +254,6 @@ object MainForm: TMainForm BorderSpacing.Left = 8 BorderSpacing.Top = 4 Caption = 'Width' - ParentColor = False end object LblViewportHeight: TLabel AnchorSideLeft.Control = GbScreenSize @@ -278,7 +267,6 @@ object MainForm: TMainForm BorderSpacing.Top = 4 BorderSpacing.Bottom = 8 Caption = 'Height' - ParentColor = False end object InfoViewportWidth: TLabel AnchorSideTop.Control = GbScreenSize @@ -293,7 +281,6 @@ object MainForm: TMainForm BorderSpacing.Top = 4 BorderSpacing.Right = 16 Caption = 'Label2' - ParentColor = False end object InfoViewportHeight: TLabel AnchorSideTop.Control = InfoViewportWidth @@ -310,7 +297,6 @@ object MainForm: TMainForm BorderSpacing.Right = 16 BorderSpacing.Bottom = 8 Caption = 'Label2' - ParentColor = False end end object CbDistanceUnits: TComboBox @@ -398,7 +384,6 @@ object MainForm: TMainForm Width = 177 BorderSpacing.Top = 8 Caption = 'Select one of the found locations:' - ParentColor = False end object BtnGoTo: TButton AnchorSideTop.Control = CbFoundLocations @@ -484,7 +469,6 @@ object MainForm: TMainForm BorderSpacing.Left = 8 BorderSpacing.Top = 4 Caption = 'Click with right mouse button to add a GPS point.'#13#10'Settings on page "Config".' - ParentColor = False WordWrap = True end object GPSPointInfo: TLabel @@ -504,7 +488,6 @@ object MainForm: TMainForm BorderSpacing.Top = 16 BorderSpacing.Right = 6 Caption = 'GPSPointInfo' - ParentColor = False WordWrap = True end end @@ -551,7 +534,6 @@ object MainForm: TMainForm BorderSpacing.Top = 8 Caption = 'Providers:' FocusControl = CbProviders - ParentColor = False end object CbProviders: TComboBox AnchorSideLeft.Control = PgConfig @@ -759,7 +741,6 @@ object MainForm: TMainForm Width = 39 BorderSpacing.Left = 8 Caption = 'Backgr.' - ParentColor = False end object Bevel1: TBevel AnchorSideLeft.Control = CbDebugTiles diff --git a/components/lazmapviewer/source/mvgpsobj.pas b/components/lazmapviewer/source/mvgpsobj.pas index fedb89d5c..2f60fcb39 100644 --- a/components/lazmapviewer/source/mvgpsobj.pas +++ b/components/lazmapviewer/source/mvgpsobj.pas @@ -67,6 +67,8 @@ type function HasElevation: boolean; function HasDateTime: Boolean; function DistanceInKmFrom(OtherPt: TGPSPoint; UseElevation: boolean=true): double; + procedure MoveTo(ALon, ALat: Double; AElevation: double = NO_ELE; + ADateTime: TDateTime = NO_DATE); property Lon: Double read GetLon; property Lat: Double read GetLat; @@ -748,8 +750,8 @@ begin end; end; -constructor TGPSPoint.Create(ALon, ALat: double; AElevation: double; - ADateTime: TDateTime); +procedure TGPSPoint.MoveTo(ALon, ALat: Double; AElevation: double = NO_ELE; + ADateTime: TDateTime = NO_DATE); begin FRealPt.Lon := ALon; FRealPt.Lat := ALat; @@ -757,6 +759,13 @@ begin FDateTime := ADateTime; end; + +constructor TGPSPoint.Create(ALon, ALat: double; AElevation: double; + ADateTime: TDateTime); +begin + MoveTo(ALon, ALat, AElevation, ADateTime); +end; + class function TGPSPoint.CreateFrom(aPt: TRealPoint; AElevation: Double = NO_ELE; ADateTime: TDateTime = NO_DATE): TGPSPoint; begin