unit Unit2;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.StdCtrls,
System.Sensors, System.Sensors.Components, FMX.WebBrowser, FMX.ListBox;
type
TForm2 =
class(TForm)
LocationSensor1: TLocationSensor;
WebBrowser1: TWebBrowser;
Button1: TButton;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form2: TForm2;
implementation
{$R *.fmx}
uses Unit1;
const
{ Was used sample from }
{ https://developers.google.com/maps/documentation/javascript/examples/directions-panel }
cRoute =
'
<!DOCTYPE html>'
+ '
<html>'
+ '
<head>'
+ '
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">'
+ '
<meta charset="utf-8">'
+ '
<title>Displaying text directions with <code>setPanel()</code></title>'
+ '
<style>'
+ '
html, body, #map-canvas {'
+ '
height: 100%;'
+ '
margin: 0px;'
+ '
padding: 0px'
+ '
}'
+ '
</style>'
+ '
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>'
+ '
'
+ '
<script>'
+ '
'
+ '
function initialize() {'
+ '
var latlng = new google.maps.LatLng(39.550189, 2.691211); '
+ '
'
+ '
var mapOptions = {'
+ '
zoom: 16,'
+ '
center: latlng, '
+ '
mapTypeId: google.maps.MapTypeId.ROADMAP, '
// ROADMAP (GROß geschrieben)
+ '
};'
+ '
var map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions);'
+ '
var marker = new google.maps.Marker({position: latlng,'
+ '
title: "Hello World!",'
+ '
animation: google.maps.Animation.BOUNCE,'
+ '
});'
+ '
marker.setMap(map);'
+ '
}'
+ '
'
+ '
function markerbc() {' <----------------------------- hier die
function "markerbc"; stimmt sie so?
+ '
var latlng2 = new google.maps.LatLng(39.551200, 2.691211); '
+ '
var marker1 = new google.maps.Marker({position: latlng2,'
+ '
title: "Hello aaa!",'
+ '
});'
+ '
marker1.setMap(map);'
+ '
}'
+ '
'
+ '
google.maps.event.addDomListener(window, ''
load''
, initialize);'
+ '
'
+ '
'
+ '
</script>'
+ '
'
+ '
</head>'
+ '
<body>'
+ '
<div id="map-canvas" style="width:100%; height:100%"> </div> '
+ '
</body>'
+ '
</html>';
procedure TForm2.Button1Click(Sender: TObject);
begin
form2.close;
end;
procedure TForm2.FormCreate(Sender: TObject);
const
a = '
markerbc()'; <----------------------------- hier die
const definiert
begin
WebBrowser1.LoadFromStrings(cRoute, '
');
WebBrowser1.EvaluateJavaScript(a); <----------------------------- hier die
function "markerbc" aufgerufen
end.