From 0d88ca9dccc61fd336a59202b04a2a2be1927b3e Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Wed, 27 Mar 2019 11:56:21 +0000 Subject: [PATCH] LazMapViewer: Add URLs for Google maps. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6838 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../lazmapviewer/example/MapViewer_Demo.lpi | 8 ++++--- components/lazmapviewer/example/main.lfm | 1 + components/lazmapviewer/example/main.pas | 5 ++++- .../synapse_downloadengine/mvdlesynapse.pas | 1 - components/lazmapviewer/source/mvdlefpc.pas | 1 - components/lazmapviewer/source/mvengine.pas | 21 +++++++++++++------ 6 files changed, 25 insertions(+), 12 deletions(-) diff --git a/components/lazmapviewer/example/MapViewer_Demo.lpi b/components/lazmapviewer/example/MapViewer_Demo.lpi index 9313b941b..0fc000eca 100644 --- a/components/lazmapviewer/example/MapViewer_Demo.lpi +++ b/components/lazmapviewer/example/MapViewer_Demo.lpi @@ -1,11 +1,13 @@ - + + + + - <Scaled Value="True"/> <ResourceType Value="res"/> @@ -15,7 +17,7 @@ </XPManifest> </General> <BuildModes Count="1"> - <Item1 Name="Default" Default="True"/> + <Item1 Name="default" Default="True"/> </BuildModes> <PublishOptions> <Version Value="2"/> diff --git a/components/lazmapviewer/example/main.lfm b/components/lazmapviewer/example/main.lfm index 7665cc8c4..5113f9b00 100644 --- a/components/lazmapviewer/example/main.lfm +++ b/components/lazmapviewer/example/main.lfm @@ -34,6 +34,7 @@ object MainForm: TMainForm BorderSpacing.Left = 8 BorderSpacing.Top = 8 BorderSpacing.Right = 8 + DropDownCount = 24 ItemHeight = 15 OnChange = CbProvidersChange Style = csDropDownList diff --git a/components/lazmapviewer/example/main.pas b/components/lazmapviewer/example/main.pas index 8dd266b67..f33971dcd 100644 --- a/components/lazmapviewer/example/main.pas +++ b/components/lazmapviewer/example/main.pas @@ -259,6 +259,9 @@ var bmp: TBitmap; img: TLazIntfImage; begin + if not (ACanvas is TFPCustomCanvas) then + exit; + // Screen coordinates of the GPS point P := TMapView(Sender).LonLatToScreen(APoint.RealPoint); @@ -273,7 +276,7 @@ begin txt := APoint.Name; bmp := TBitmap.Create; try - bmp.PixelFormat := pf32Bit; +// bmp.PixelFormat := pf32Bit; w := bmp.Canvas.TextWidth(txt); h := bmp.Canvas.TextHeight(txt); bmp.SetSize(w, h); diff --git a/components/lazmapviewer/source/addons/synapse_downloadengine/mvdlesynapse.pas b/components/lazmapviewer/source/addons/synapse_downloadengine/mvdlesynapse.pas index fa36e9ad9..114791a41 100644 --- a/components/lazmapviewer/source/addons/synapse_downloadengine/mvdlesynapse.pas +++ b/components/lazmapviewer/source/addons/synapse_downloadengine/mvdlesynapse.pas @@ -68,7 +68,6 @@ var realURL: String; i: Integer; begin - inherited DownloadFile(Url, str); FHttp := THTTPSend.Create; try if FUseProxy then diff --git a/components/lazmapviewer/source/mvdlefpc.pas b/components/lazmapviewer/source/mvdlefpc.pas index 5bfb52333..43347915f 100644 --- a/components/lazmapviewer/source/mvdlefpc.pas +++ b/components/lazmapviewer/source/mvdlefpc.pas @@ -68,7 +68,6 @@ procedure TMVDEFPC.DownloadFile(const Url: string; AStream: TStream); var http: TFpHttpClient; begin - inherited; http := TFpHttpClient.Create(nil); try {$IF FPC_FullVersion >= 30000} diff --git a/components/lazmapviewer/source/mvengine.pas b/components/lazmapviewer/source/mvengine.pas index a32951ef3..540463b55 100644 --- a/components/lazmapviewer/source/mvengine.pas +++ b/components/lazmapviewer/source/mvengine.pas @@ -761,14 +761,25 @@ end; procedure TMapViewerEngine.RegisterProviders; begin - AddMapProvider('Aucun','',0,30, 0); - { - AddMapProvider('Google Satellite','http://khm%d.google.com/kh/v=82&x=%x%&y=%y%&z=%z%&s=Ga',4); +// AddMapProvider('Aucun','',0,30, 0); ??? + + AddMapProvider('Google Normal', + 'http://mt%serv%.google.com/vt/lyrs=m@145&v=w2.104&x=%x%&y=%y%&z=%z%', + 0, 19, 4, nil); + AddMapProvider('Google Hybrid', + 'http://mt%serv%.google.com/vt/lyrs=h@145&v=w2.104&x=%x%&y=%y%&z=%z%', + 0, 19, 4, nil); + AddMapProvider('Google Physical', + 'http://mt%serv%.google.com/vt/lyrs=t@145&v=w2.104&x=%x%&y=%y%&z=%z%', + 0, 19, 4, nil); + + { AddMapProvider('Google Hybrid','http://khm%d.google.com/kh/v=82&x=%x%&y=%y%&z=%z%&s=Ga',4); AddMapProvider('Google Hybrid','http://mt%d.google.com/vt/lyrs=h@145&v=w2.104&x=%d&y=%d&z=%z%',4); AddMapProvider('Google physical','http://mt%d.google.com/vt/lyrs=t@145&v=w2.104&x=%d&y=%d&z=%z%',4); AddMapProvider('Google Physical Hybrid','http://mt%d.google.com/vt/lyrs=t@145&v=w2.104&x=%x%&y=%y%&z=%z%',4); - AddMapProvider('Google Physical Hybrid','http://mt%d.google.com/vt/lyrs=h@145&v=w2.104&x=%x%&y=%y%&z=%z%',4);} + AddMapProvider('Google Physical Hybrid','http://mt%d.google.com/vt/lyrs=h@145&v=w2.104&x=%x%&y=%y%&z=%z%',4); + } //AddMapProvider('OpenStreetMap Osmarender','http://%serv%.tah.openstreetmap.org/Tiles/tile/%z%/%x%/%y%.png',0,20,3, @getLetterSvr); // [Char(Ord('a')+Random(3)), Z, X, Y])); //AddMapProvider('Yahoo Normal','http://maps%serv%.yimg.com/hx/tl?b=1&v=4.3&.intl=en&x=%x%&y=%y%d&z=%d&r=1' , 0,20,3,@GetYahooSvr, nil, @getYahooY, @GetYahooZ); //(Z+1])); //AddMapProvider('Yahoo Satellite','http://maps%serv%.yimg.com/ae/ximg?v=1.9&t=a&s=256&.intl=en&x=%d&y=%d&z=%d&r=1', 0,20,3,@GetYahooSvr, nil, @getYahooY, @GetYahooZ); //[Random(3)+1, X, YahooY(Y), Z+1])); @@ -806,8 +817,6 @@ begin AddMapProvider('Ovi Physical', 'http://%serv%.maptile.maps.svc.ovi.com/maptiler/v2/maptile/newest/terrain.day/%z%/%x%/%y%/256/png8', 0, 20, 5, @GetLetterSvr); -// AddMapProvider('Google Normal', 'http://mt%d.google.com/vt/lyrs=m@145&v=w2.104&x=%d&y=%d&z=%d', [Random(4), X, Y, Z])); - { AddMapProvider('Yahoo Normal','http://maps%serv%.yimg.com/hx/tl?b=1&v=4.3&.intl=en&x=%x%&y=%y%d&z=%d&r=1' , 0,20,3,@GetYahooSvr, nil, @getYahooY, @GetYahooZ); //(Z+1]));