Skip to content

Commit e58d7f2

Browse files
committed
Fix FromLatLng and ToLatLng on btnGeometryComputeDistanceBetweenClick.
Reduce MaxTimeResponse and Step on GeometryComputeDistanceBetween function.
1 parent 8cb419f commit e58d7f2

File tree

3 files changed

+23
-55
lines changed

3 files changed

+23
-55
lines changed

Demo/GoogleMaps/MainForm.dfm

Lines changed: 19 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,7 @@ object formMain: TformMain
395395
ActivePage = TabMarkers
396396
Align = alClient
397397
TabOrder = 0
398+
ExplicitWidth = 501
398399
object TabMarkers: TTabSheet
399400
Caption = 'Markers'
400401
object Panel12: TPanel
@@ -404,7 +405,7 @@ object formMain: TformMain
404405
Height = 41
405406
Align = alBottom
406407
TabOrder = 0
407-
ExplicitTop = 122
408+
ExplicitWidth = 493
408409
DesignSize = (
409410
497
410411
41)
@@ -428,11 +429,10 @@ object formMain: TformMain
428429
Caption = 'Clear Markers'
429430
TabOrder = 1
430431
OnClick = ButtonClearMarkersClick
431-
ExplicitLeft = 881
432-
ExplicitHeight = 39
432+
ExplicitLeft = 388
433433
end
434434
object chMarkerShowHide: TCheckBox
435-
Left = 286
435+
Left = 282
436436
Top = 12
437437
Width = 97
438438
Height = 17
@@ -442,6 +442,7 @@ object formMain: TformMain
442442
State = cbChecked
443443
TabOrder = 2
444444
OnClick = chMarkerShowHideClick
445+
ExplicitLeft = 278
445446
end
446447
end
447448
object PageControlMarker: TPageControl
@@ -452,10 +453,7 @@ object formMain: TformMain
452453
ActivePage = LatLongMarkerTabSheet
453454
Align = alClient
454455
TabOrder = 1
455-
ExplicitLeft = 1
456-
ExplicitTop = 1
457-
ExplicitWidth = 495
458-
ExplicitHeight = 39
456+
ExplicitWidth = 493
459457
object LatLongMarkerTabSheet: TTabSheet
460458
Caption = 'Latitute/Longitude'
461459
object GridPanel1: TGridPanel
@@ -488,8 +486,7 @@ object formMain: TformMain
488486
Value = 50.000000000000000000
489487
end>
490488
TabOrder = 0
491-
ExplicitWidth = 487
492-
ExplicitHeight = 11
489+
ExplicitWidth = 485
493490
object GridPanel2: TGridPanel
494491
Left = 0
495492
Top = 0
@@ -520,8 +517,7 @@ object formMain: TformMain
520517
Value = 100.000000000000000000
521518
end>
522519
TabOrder = 0
523-
ExplicitWidth = 487
524-
ExplicitHeight = 6
520+
ExplicitWidth = 485
525521
object Panel2: TPanel
526522
Left = 0
527523
Top = 0
@@ -530,7 +526,7 @@ object formMain: TformMain
530526
Align = alClient
531527
BevelOuter = bvNone
532528
TabOrder = 0
533-
ExplicitHeight = 6
529+
ExplicitWidth = 242
534530
object Label9: TLabel
535531
AlignWithMargins = True
536532
Left = 3
@@ -549,6 +545,7 @@ object formMain: TformMain
549545
Height = 21
550546
Align = alTop
551547
TabOrder = 0
548+
ExplicitWidth = 236
552549
end
553550
end
554551
object Panel3: TPanel
@@ -559,8 +556,8 @@ object formMain: TformMain
559556
Align = alClient
560557
BevelOuter = bvNone
561558
TabOrder = 1
559+
ExplicitLeft = 242
562560
ExplicitWidth = 243
563-
ExplicitHeight = 6
564561
object Label10: TLabel
565562
AlignWithMargins = True
566563
Left = 3
@@ -591,9 +588,7 @@ object formMain: TformMain
591588
Align = alClient
592589
BevelOuter = bvNone
593590
TabOrder = 1
594-
ExplicitTop = 6
595-
ExplicitWidth = 487
596-
ExplicitHeight = 5
591+
ExplicitWidth = 485
597592
object Label11: TLabel
598593
AlignWithMargins = True
599594
Left = 3
@@ -612,7 +607,7 @@ object formMain: TformMain
612607
Height = 21
613608
Align = alTop
614609
TabOrder = 0
615-
ExplicitWidth = 481
610+
ExplicitWidth = 479
616611
end
617612
end
618613
end
@@ -762,7 +757,6 @@ object formMain: TformMain
762757
ActivePage = TabSheet1
763758
Align = alClient
764759
TabOrder = 0
765-
ExplicitHeight = 124
766760
object TabSheet1: TTabSheet
767761
Caption = 'Latitute/Longitude'
768762
object GridPanel3: TGridPanel
@@ -800,7 +794,6 @@ object formMain: TformMain
800794
SizeStyle = ssAuto
801795
end>
802796
TabOrder = 0
803-
ExplicitHeight = 96
804797
object GridPanel4: TGridPanel
805798
Left = 0
806799
Top = 0
@@ -837,7 +830,6 @@ object formMain: TformMain
837830
SizeStyle = ssAuto
838831
end>
839832
TabOrder = 0
840-
ExplicitHeight = 48
841833
object Panel4: TPanel
842834
Left = 0
843835
Top = 0
@@ -846,7 +838,6 @@ object formMain: TformMain
846838
Align = alClient
847839
BevelOuter = bvNone
848840
TabOrder = 0
849-
ExplicitHeight = 48
850841
object Label15: TLabel
851842
AlignWithMargins = True
852843
Left = 3
@@ -875,7 +866,6 @@ object formMain: TformMain
875866
Align = alClient
876867
BevelOuter = bvNone
877868
TabOrder = 1
878-
ExplicitHeight = 48
879869
object Label16: TLabel
880870
AlignWithMargins = True
881871
Left = 3
@@ -905,8 +895,6 @@ object formMain: TformMain
905895
Align = alLeft
906896
BevelOuter = bvNone
907897
TabOrder = 1
908-
ExplicitTop = 48
909-
ExplicitHeight = 48
910898
object Label21: TLabel
911899
AlignWithMargins = True
912900
Left = 3
@@ -1104,7 +1092,6 @@ object formMain: TformMain
11041092
'</div>')
11051093
TabOrder = 0
11061094
WordWrap = False
1107-
ExplicitHeight = 71
11081095
end
11091096
end
11101097
end
@@ -1115,12 +1102,11 @@ object formMain: TformMain
11151102
Height = 41
11161103
Align = alBottom
11171104
TabOrder = 1
1118-
ExplicitTop = 119
11191105
DesignSize = (
11201106
497
11211107
41)
11221108
object chCirclesShowHide: TCheckBox
1123-
Left = 286
1109+
Left = 282
11241110
Top = 12
11251111
Width = 97
11261112
Height = 17
@@ -1151,8 +1137,6 @@ object formMain: TformMain
11511137
Caption = 'Clear Circles'
11521138
TabOrder = 2
11531139
OnClick = btnClearCirclesClick
1154-
ExplicitLeft = 396
1155-
ExplicitTop = 8
11561140
end
11571141
end
11581142
end
@@ -1167,7 +1151,6 @@ object formMain: TformMain
11671151
ActivePage = TabSheet5
11681152
Align = alClient
11691153
TabOrder = 0
1170-
ExplicitHeight = 124
11711154
object TabSheet5: TTabSheet
11721155
Caption = 'Path'
11731156
object ePolylinePath: TMemo
@@ -1185,7 +1168,6 @@ object formMain: TformMain
11851168
']')
11861169
TabOrder = 0
11871170
WordWrap = False
1188-
ExplicitHeight = 90
11891171
end
11901172
end
11911173
object TabSheet6: TTabSheet
@@ -1339,7 +1321,6 @@ object formMain: TformMain
13391321
'</div>')
13401322
TabOrder = 0
13411323
WordWrap = False
1342-
ExplicitHeight = 71
13431324
end
13441325
end
13451326
end
@@ -1350,12 +1331,11 @@ object formMain: TformMain
13501331
Height = 41
13511332
Align = alBottom
13521333
TabOrder = 1
1353-
ExplicitTop = 119
13541334
DesignSize = (
13551335
497
13561336
41)
13571337
object chPolylinesShowHide: TCheckBox
1358-
Left = 286
1338+
Left = 282
13591339
Top = 12
13601340
Width = 97
13611341
Height = 17
@@ -1386,8 +1366,6 @@ object formMain: TformMain
13861366
Caption = 'Clear Polylines'
13871367
TabOrder = 2
13881368
OnClick = btnClearPolylinesClick
1389-
ExplicitLeft = 396
1390-
ExplicitTop = 8
13911369
end
13921370
end
13931371
end
@@ -1402,7 +1380,6 @@ object formMain: TformMain
14021380
ActivePage = TabSheet9
14031381
Align = alClient
14041382
TabOrder = 0
1405-
ExplicitHeight = 124
14061383
object TabSheet9: TTabSheet
14071384
Caption = 'Path'
14081385
object ePolygonPath: TMemo
@@ -1422,7 +1399,6 @@ object formMain: TformMain
14221399
']')
14231400
TabOrder = 0
14241401
WordWrap = False
1425-
ExplicitHeight = 90
14261402
end
14271403
end
14281404
object TabSheet10: TTabSheet
@@ -1602,7 +1578,6 @@ object formMain: TformMain
16021578
'</div>')
16031579
TabOrder = 0
16041580
WordWrap = False
1605-
ExplicitHeight = 71
16061581
end
16071582
end
16081583
end
@@ -1613,12 +1588,11 @@ object formMain: TformMain
16131588
Height = 41
16141589
Align = alBottom
16151590
TabOrder = 1
1616-
ExplicitTop = 122
16171591
DesignSize = (
16181592
497
16191593
41)
16201594
object chPolygonsShowHide: TCheckBox
1621-
Left = 286
1595+
Left = 282
16221596
Top = 12
16231597
Width = 97
16241598
Height = 17
@@ -1649,8 +1623,6 @@ object formMain: TformMain
16491623
Caption = 'Clear Polygons'
16501624
TabOrder = 2
16511625
OnClick = btnClearPolygonsClick
1652-
ExplicitLeft = 396
1653-
ExplicitTop = 8
16541626
end
16551627
end
16561628
end
@@ -1665,7 +1637,6 @@ object formMain: TformMain
16651637
Align = alClient
16661638
Caption = 'ComputeDistanceBetween'
16671639
TabOrder = 0
1668-
ExplicitTop = 1
16691640
object Label34: TLabel
16701641
AlignWithMargins = True
16711642
Left = 11
@@ -1908,7 +1879,7 @@ object formMain: TformMain
19081879
Caption = 'Load Table'
19091880
TabOrder = 2
19101881
OnClick = LoadTableButtonClick
1911-
ExplicitLeft = 776
1882+
ExplicitLeft = 1204
19121883
end
19131884
object Button1: TButton
19141885
AlignWithMargins = True
@@ -1930,7 +1901,7 @@ object formMain: TformMain
19301901
Align = alClient
19311902
BevelOuter = bvNone
19321903
TabOrder = 5
1933-
ExplicitWidth = 428
1904+
ExplicitWidth = 856
19341905
object Label7: TLabel
19351906
Left = 0
19361907
Top = 0
@@ -1949,7 +1920,7 @@ object formMain: TformMain
19491920
Align = alTop
19501921
TabOrder = 0
19511922
Text = 'customer.xml'
1952-
ExplicitWidth = 422
1923+
ExplicitWidth = 850
19531924
end
19541925
end
19551926
end

Demo/GoogleMaps/MainForm.pas

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -598,9 +598,9 @@ procedure TformMain.btnGeometryComputeDistanceBetweenClick(Sender: TObject);
598598
Distance:Double;
599599
begin
600600
FromLatLng.Latitude := TEdgeGoogleMapViewer.TextToCoord(eGeometryFromLat.Text);
601-
FromLatLng.Latitude := TEdgeGoogleMapViewer.TextToCoord(eGeometryFromLng.Text);
601+
FromLatLng.Longitude := TEdgeGoogleMapViewer.TextToCoord(eGeometryFromLng.Text);
602602
ToLatLng.Latitude := TEdgeGoogleMapViewer.TextToCoord(eGeometryToLat.Text);
603-
ToLatLng.Latitude := TEdgeGoogleMapViewer.TextToCoord(eGeometryToLng.Text);
603+
ToLatLng.Longitude := TEdgeGoogleMapViewer.TextToCoord(eGeometryToLng.Text);
604604

605605
Distance:=EdgeGoogleMapViewer.ComputeDistanceBetween(FromLatLng,ToLatLng);
606606
Showmessage(Format('Distance %8.2f mts',[Distance]));

Source/Vcl.GoogleMap.pas

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1448,7 +1448,6 @@ procedure TEdgeGoogleMapViewer.PutCircle(LatLng: TLatLng; Radius: Double; Editab
14481448
AInfoWindowContent : string = '');
14491449
var
14501450
LScriptCommand: String;
1451-
LInfoWindowContent : string;
14521451
begin
14531452
FormatSettings.DecimalSeparator := '.';
14541453
if not MapVisible then
@@ -1552,7 +1551,6 @@ procedure TEdgeGoogleMapViewer.PutPolyline(Path:String; Geodesic, Editable, Visi
15521551
AInfoWindowContent : string = '');
15531552
var
15541553
LScriptCommand: String;
1555-
LInfoWindowContent : string;
15561554
begin
15571555
FormatSettings.DecimalSeparator := '.';
15581556
if not MapVisible then
@@ -1625,8 +1623,8 @@ function TEdgeGoogleMapViewer.GetJSGeometry: String;
16251623

16261624
function TEdgeGoogleMapViewer.ComputeDistanceBetween(Origin, Destination: TLatLng): Double;
16271625
Const
1628-
MaxTimeResponse = 10000; //Miliseconds
1629-
Step = 100; //Miliseconds
1626+
MaxTimeResponse = 2000; //Miliseconds
1627+
Step = 1; //Miliseconds
16301628
var
16311629
LScriptCommand: String;
16321630
i: Integer;
@@ -1700,7 +1698,6 @@ procedure TEdgeGoogleMapViewer.PutPolygon(Path:String; Editable, Visible, Clicka
17001698
AInfoWindowContent : string = '');
17011699
var
17021700
LScriptCommand: String;
1703-
LInfoWindowContent : string;
17041701
begin
17051702
FormatSettings.DecimalSeparator := '.';
17061703
if not MapVisible then

0 commit comments

Comments
 (0)