unit sensormap;
{ Magenta GPS and Location Component sample application
Updated by Angus Robertson, Magenta Systems Ltd, England, 2nd February 2022
delphi@magsys.co.uk, https://www.magsys.co.uk/delphi/
Copyright Magenta Systems Ltd
Display a Google map to plot GPS locations.
This sample includes a Google maps display for tracking GPS location movement
using the TWebBrowser component which uses the Internet Explorer engine.
Unfortunately Microsoft has removed Internet Explorer from Windows 11 so map
display is more problematic, currently it still works but Google displays a
warning about using non-supported browser and plans to remove support for
MSIE in August 2022. Delphi 10.4 and later has a new TEdgeBrowser component
that is used by the sensoredgemap.pas unit which should be used instead of
sensormap.pas, it is easier to use than TWebBrowser.
}
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, OleCtrls, SHDocVw, ExtCtrls, ActiveX, MSHTML, IniFiles,
magsubs4;
const
WM_MAP_UPDATE = WM_USER + 321 ;
type
TFormMap = class(TForm)
Panel1: TPanel;
WebBrowser: TWebBrowser;
doClose: TButton;
EditAddr: TEdit;
doAddress: TButton;
CheckRealTime: TCheckBox;
doClear: TButton;
LabelUpdate: TLabel;
CheckRoute: TCheckBox;
procedure WebBrowserCommandStateChange(ASender: TObject; Command: Integer; Enable: WordBool);
procedure doCloseClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure doAddressClick(Sender: TObject);
procedure CheckRealTimeClick(Sender: TObject);
procedure doClearClick(Sender: TObject);
private
{ Private declarations }
HTMLWindow2: IHTMLWindow2;
procedure WMMAPUPDATE(var Msg : TMessage); message WM_MAP_UPDATE ;
public
{ Public declarations }
procedure PlotLatLong;
end;
var
FormMap: TFormMap;
PendingLatLong: boolean = false ;
const
(*
// Dec 2016 get script errors using PutMarker2 with circle icon
HTMLStr: AnsiString =
' '+#13#10+
'