...
procedure TForm1.GeoListViewDblClick(Sender: TObject);
begin
FCurrentIndex := GeoListView.ItemIndex;
RunTimer.Enabled := ((GeoListView.Items.Count > 0)
and (FScreenShotPath <> EmptyStr));
end;
procedure TForm1.ItsTime(Sender: TObject);
begin
RunTimer.Enabled := False;
if Script=nil
then
with TScript.Create(WebBrowser1)
do
LoadAPIAsync(InitMap);
end;
procedure TForm1.InitMap(Sender: TObject);
function StrToDouble(Value :
String) : Double;
begin
Result := StrToFloat(StringReplace(Value, '
.', '
,', [rfReplaceAll, rfIgnoreCase]));
end;
var
MyOptions : TMapOptions;
LI : TListItem;
Latitude : Double;
Longitude : Double;
ZoomF : Integer;
TypeID : Byte;
Url :
String;
begin
LI := GeoListView.Items[FCurrentIndex];
if ((LI.SubItems[3] = EmptyStr)
and // Latitude
(LI.SubItems[4] = EmptyStr)
and // Logitude
(LI.SubItems[5] = EmptyStr))
then // Zoom
begin
Url := Copy(LI.SubItems[0], POS('
@', LI.SubItems[0]) + 1, Length(LI.SubItems[0]));
Latitude := StrToDouble(Copy(
Url, 1, POS('
,',
Url) - 1));
Url := Copy(
Url, POS('
,',
Url) + 1, Length(
Url));
Longitude := StrToDouble(Copy(
Url, 1, POS('
,',
Url) - 1));
Url := Copy(
Url, POS('
,',
Url) + 1, Length(
Url));
ZoomF := Round(StrToDouble(Copy(
Url, 1, POS('
z',
Url) -1)));
end
else
begin
Latitude := StrToDouble(LI.SubItems[3]);
Longitude := StrToDouble(LI.SubItems[4]);
ZoomF := Round(StrToDouble(Copy(LI.SubItems[5], 1, POS('
z', LI.SubItems[5]) -1)));
end;
TypeID := Ord(LI.SubItems[6][1]);
with TScript(Sender)
do
begin
MyOptions := TMapOptions.Create;
with MyOptions
do
begin
Zoom := ZoomF;
Center := New(Google.Maps.LatLng(Latitude, Longitude));
case TypeID
of
72 : MapTypeID := Google.Maps.MapTypeID.Hybrid;
82 : MapTypeID := Google.Maps.MapTypeID.Roadmap;
83 : MapTypeID := Google.Maps.MapTypeID.Satellite;
84 : MapTypeID := Google.Maps.MapTypeID.Terrain;
end;
end;
New(Google.Maps.Map(MyOptions));
end;
end;