http://developer.baidu.com/map/jsdemo.htm#i7_1
地址是调用方法的例子.
unit Unit1;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes,
System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.WebBrowser,
FMX.Controls.Presentation, FMX.Edit, FMX.StdCtrls;
type
TForm1 = class(TForm)
addr: TEdit;
WebBrowser1: TWebBrowser;
CornerButton1: TCornerButton;
city: TEdit;
procedure CornerButton1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
Scity: string;
Saddr: string;
s1: string;
const
s = ' ' + ' ' + ' ' +
'
' +
'
' +
' ' +
' '
+ '
地址解析 ' + ' ' + ' ' +
'
' + ' ' + ' ';
implementation
{$R *.fmx}
{$R *.LgXhdpiPh.fmx ANDROID}
procedure TForm1.CornerButton1Click(Sender: TObject);
begin
s1 := 'var map = new BMap.Map("allmap");' +
'var point = new BMap.Point(116.331398,39.897445);' +
'map.centerAndZoom(point,15);' + 'map.enableScrollWheelZoom();' +
'var myGeo = new BMap.Geocoder(); ' +
'myGeo.getPoint("%s", function(point){ ' + ' if (point) {' +
'map.centerAndZoom(point, 16); ' +
'map.addOverlay(new BMap.Marker(point)); ' + '
}else{ ' +
'alert("您选择地址没有解析到结果!"); ' + ' } ' + ' }, "%s"); ';
s1 := format(s1, [addr.text, city.text]);
WebBrowser1.EvaluateJavaScript(s1);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
WebBrowser1.LoadFromStrings(s, 'http://api.map.baidu.com'); // 调入网页
end;
end.