LazMapViewer: Fix GPSPointIntfo display in both fulldemo projects

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@9311 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz 2024-04-02 21:29:43 +00:00
parent 9fcf346d74
commit ebb5b52522
4 changed files with 59 additions and 53 deletions

View File

@ -15,7 +15,6 @@ object MainForm: TMainForm
object MapView: TMapView
Left = 0
Height = 589
Hint = 'Displays the map'
Top = 0
Width = 475
Align = alClient
@ -448,14 +447,13 @@ object MainForm: TMainForm
AnchorSideRight.Control = GbSearch
AnchorSideRight.Side = asrBottom
Left = 4
Height = 92
Height = 116
Top = 364
Width = 259
Anchors = [akTop, akLeft, akRight]
AutoSize = True
BorderSpacing.Top = 6
Caption = 'GPS points'
ClientHeight = 72
ClientHeight = 96
ClientWidth = 255
TabOrder = 6
object BtnGPSPoints: TButton
@ -499,16 +497,15 @@ object MainForm: TMainForm
AnchorSideBottom.Control = GbGPS
AnchorSideBottom.Side = asrBottom
Left = 6
Height = 15
Height = 33
Top = 57
Width = 245
Anchors = [akTop, akLeft, akRight, akBottom]
AutoSize = False
BorderSpacing.Top = 10
BorderSpacing.Right = 4
Caption = 'GPSPointInfo'
BorderSpacing.Bottom = 6
Caption = 'GPSPointInfo'#13#10'Coords'
ParentColor = False
WordWrap = True
end
end
object BtnSaveToFile: TButton
@ -517,7 +514,7 @@ object MainForm: TMainForm
AnchorSideTop.Side = asrBottom
Left = 4
Height = 25
Top = 462
Top = 486
Width = 110
AutoSize = True
BorderSpacing.Top = 6
@ -531,7 +528,7 @@ object MainForm: TMainForm
AnchorSideTop.Control = BtnSaveToFile
Left = 120
Height = 25
Top = 462
Top = 486
Width = 105
AutoSize = True
BorderSpacing.Left = 6
@ -547,7 +544,7 @@ object MainForm: TMainForm
AnchorSideRight.Side = asrBottom
Left = 4
Height = 26
Top = 493
Top = 517
Width = 110
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 6

View File

@ -517,7 +517,7 @@ begin
InfoCenterLatitude.Caption := '';
InfoViewportWidth.Caption := '';
InfoViewportHeight.Caption := '';
GPSPointInfo.caption := '';
GPSPointInfo.Caption := '';
for I := 0 to High(TileLayer) do
begin
@ -670,30 +670,38 @@ end;
procedure TMainForm.MapViewMouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer);
const
DELTA = 3;
var
objs: TGpsObjArray;
rArea: TRealArea;
gpsList: TGpsObjList;
L: TStrings;
i: Integer;
begin
UpdateCoords(X, Y);
objs := MapView.ObjsAtScreenPt(X, Y);
if Length(objs) > 0 then
begin
L := TStringList.Create;
try
for i := 0 to High(objs) do
if objs[i] is TGpsPoint then
with TGpsPoint(objs[i]) do
L.Add(Format('%s (%s / %s)', [
Name, LatToStr(Lat, USE_DMS), LonToStr(Lon, USE_DMS)
]));
GPSPointInfo.Caption := L.Text;
finally
L.Free;
end;
end else
GPSPointInfo.Caption := '';
rArea.TopLeft := MapView.ScreenToLatLon(Point(X-DELTA, Y-DELTA));
rArea.BottomRight := MapView.ScreenToLatLon(Point(X+DELTA, Y+DELTA));
gpsList := MapView.GpsItems.GetObjectsInArea(rArea);
try
if gpsList.Count > 0 then begin
L := TStringList.Create;
try
for i:=0 to gpsList.Count-1 do
if gpsList[i] is TGpsPoint then
with TGpsPoint(gpsList[i]) do
L.Add(Format('%s' + LineEnding + ' %s / %s', [
Name, LatToStr(Lat, USE_DMS), LonToStr(Lon, USE_DMS)
]));
GPSPointInfo.Caption := L.Text;
finally
L.Free;
end;
end else
GPSPointInfo.Caption := '';
finally
gpsList.Free;
end;
end;
procedure TMainForm.MapViewMouseUp(Sender: TObject; Button: TMouseButton;

View File

@ -14,7 +14,6 @@ object MainForm: TMainForm
object MapView: TMapView
Left = 0
Height = 662
Hint = 'Displays the map'
Top = 0
Width = 667
Align = alClient
@ -38,9 +37,9 @@ object MainForm: TMainForm
Height = 662
Top = 0
Width = 275
ActivePage = PgConfig
ActivePage = PgData
Align = alRight
TabIndex = 2
TabIndex = 0
TabOrder = 1
object PgData: TTabSheet
Caption = 'Data'
@ -445,13 +444,13 @@ object MainForm: TMainForm
AnchorSideRight.Control = GbSearch
AnchorSideRight.Side = asrBottom
Left = 6
Height = 105
Height = 108
Top = 404
Width = 255
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 8
Caption = 'GPS points'
ClientHeight = 85
ClientHeight = 88
ClientWidth = 251
TabOrder = 6
object BtnGPSPoints: TButton
@ -495,14 +494,15 @@ object MainForm: TMainForm
AnchorSideBottom.Control = GbGPS
AnchorSideBottom.Side = asrBottom
Left = 8
Height = 35
Height = 32
Top = 50
Width = 237
Anchors = [akTop, akLeft, akRight, akBottom]
AutoSize = False
BorderSpacing.Top = 16
BorderSpacing.Right = 6
Caption = 'GPSPointInfo'
BorderSpacing.Bottom = 6
Caption = 'GPSPointInfo'#13#10'Coords'
ParentColor = False
WordWrap = True
end
@ -513,7 +513,7 @@ object MainForm: TMainForm
AnchorSideTop.Side = asrBottom
Left = 6
Height = 25
Top = 517
Top = 520
Width = 110
AutoSize = True
BorderSpacing.Top = 8
@ -527,7 +527,7 @@ object MainForm: TMainForm
AnchorSideTop.Control = BtnSaveToFile
Left = 124
Height = 25
Top = 517
Top = 520
Width = 105
AutoSize = True
BorderSpacing.Left = 8
@ -871,10 +871,10 @@ object MainForm: TMainForm
AnchorSideTop.Side = asrBottom
Left = 6
Height = 19
Top = 394
Top = 388
Width = 79
BorderSpacing.Left = 6
BorderSpacing.Top = 12
BorderSpacing.Top = 6
Caption = 'Use threads'
Checked = True
State = cbChecked
@ -887,7 +887,7 @@ object MainForm: TMainForm
AnchorSideTop.Side = asrBottom
Left = 6
Height = 19
Top = 419
Top = 413
Width = 85
BorderSpacing.Top = 6
BorderSpacing.Right = 9
@ -903,7 +903,7 @@ object MainForm: TMainForm
AnchorSideTop.Side = asrBottom
Left = 6
Height = 19
Top = 444
Top = 438
Width = 77
BorderSpacing.Top = 6
Caption = 'Debug tiles'
@ -916,7 +916,7 @@ object MainForm: TMainForm
AnchorSideTop.Side = asrBottom
Left = 6
Height = 19
Top = 481
Top = 475
Width = 105
BorderSpacing.Top = 6
Caption = 'Show POI image'
@ -928,7 +928,7 @@ object MainForm: TMainForm
AnchorSideTop.Side = asrBottom
Left = 8
Height = 25
Top = 508
Top = 502
Width = 93
AutoSize = True
BorderSpacing.Top = 8
@ -945,7 +945,7 @@ object MainForm: TMainForm
AnchorSideRight.Side = asrBottom
Left = 156
Height = 22
Top = 509
Top = 503
Width = 105
NoneColorColor = clWhite
Style = [cbStandardColors, cbExtendedColors, cbIncludeNone, cbCustomColor, cbPrettyNames, cbCustomColors]
@ -962,7 +962,7 @@ object MainForm: TMainForm
AnchorSideTop.Side = asrCenter
Left = 109
Height = 15
Top = 513
Top = 507
Width = 39
BorderSpacing.Left = 8
Caption = 'Backgr.'
@ -976,7 +976,7 @@ object MainForm: TMainForm
AnchorSideRight.Side = asrBottom
Left = 6
Height = 4
Top = 471
Top = 465
Width = 255
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 8
@ -1058,7 +1058,7 @@ object MainForm: TMainForm
AnchorSideTop.Side = asrCenter
Left = 130
Height = 19
Top = 394
Top = 388
Width = 83
Caption = 'Preview tiles'
Checked = True
@ -1072,7 +1072,7 @@ object MainForm: TMainForm
AnchorSideTop.Side = asrCenter
Left = 130
Height = 30
Top = 413
Top = 407
Width = 108
BorderWidth = 2
ButtonColorAutoSize = False
@ -1267,7 +1267,7 @@ object MainForm: TMainForm
object FontDialog: TFontDialog
MinFontSize = 0
MaxFontSize = 0
Left = 800
Top = 528
Left = 736
Top = 544
end
end

View File

@ -454,6 +454,7 @@ begin
MapView.POIImage.Assign(POIImage)
else
MapView.POIImage.Clear;
MapView.Invalidate;
end;
procedure TMainForm.CbUseThreadsChange(Sender: TObject);
@ -656,7 +657,7 @@ begin
for i:=0 to gpsList.Count-1 do
if gpsList[i] is TGpsPoint then
with TGpsPoint(gpsList[i]) do
L.Add(Format('%s (%s / %s)', [
L.Add(Format('%s' + LineEnding + ' %s / %s', [
Name, LatToStr(Lat, USE_DMS), LonToStr(Lon, USE_DMS)
]));
GPSPointInfo.Caption := L.Text;