Skip to content

Commit 7d8622f

Browse files
authored
changes API Google Maps
1 parent 6e3cd69 commit 7d8622f

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

src/VCL/GMMapVCL.pas

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ TCustomGMMapVCL = class(TCustomGMMap)
140140
procedure Assign(Source: TPersistent); override;
141141

142142
procedure SaveToJPGFile(FileName: TFileName = ''); override;
143+
procedure SaveHTML(FileName: TFileName = ''); override;
143144
published
144145
property VisualProp: TVisualProp read FVisualProp write FVisualProp;
145146
end;
@@ -335,7 +336,7 @@ procedure TGMMap.DocumentComplete(ASender: TObject; const pDisp: IDispatch;
335336
begin
336337
if Assigned(OldDocumentComplete) then OldDocumentComplete(ASender, pDisp, URL);
337338

338-
if (pDisp = CurDispatch) then // si son iguales, la página se ha cargado
339+
if not FDocLoaded and (pDisp = CurDispatch) then // si son iguales, la página se ha cargado
339340
begin
340341
FDocLoaded := True;
341342
CurDispatch := nil;
@@ -636,6 +637,36 @@ destructor TCustomGMMapVCL.Destroy;
636637
inherited;
637638
end;
638639

640+
procedure TCustomGMMapVCL.SaveHTML(FileName: TFileName);
641+
var
642+
SD: TSaveDialog;
643+
L: TStringList;
644+
begin
645+
inherited;
646+
647+
if not Assigned(FWebBrowser) or not Assigned(FWC) then Exit;
648+
649+
if FileName = '' then
650+
begin
651+
SD := TSaveDialog.Create(nil);
652+
try
653+
SD.Filter := '*.html|*.html';
654+
SD.DefaultExt := '*.html';
655+
if SD.Execute then FileName := SD.FileName;
656+
finally
657+
FreeAndNil(SD);
658+
end;
659+
end;
660+
661+
L := TStringList.Create;
662+
try
663+
L.Text := FWC.WebHTMLCode;
664+
L.SaveToFile(FileName);
665+
finally
666+
FreeAndNil(L);
667+
end;
668+
end;
669+
639670
procedure TCustomGMMapVCL.SaveToJPGFile(FileName: TFileName);
640671
var
641672
SD: TSaveDialog;

0 commit comments

Comments
 (0)