lazmapviewer: Duplicate example project to demonstrate usage without external drawing engines. Cache folder is shared between both demos.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7185 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2019-11-12 17:46:50 +00:00
parent f4ff85e64a
commit f830900825
11 changed files with 2269 additions and 101 deletions

View File

@ -7,8 +7,7 @@ interface
uses
Classes, SysUtils, Types, Forms, Controls, Graphics, Dialogs,
ExtCtrls, StdCtrls, ComCtrls, Buttons, IntfGraphics, ColorBox,
mvGeoNames, mvMapViewer, mvTypes, mvGpsObj, mvDrawingEngine,
mvDE_RGBGraphics, mvDE_BGRA;
mvGeoNames, mvMapViewer, mvTypes, mvGpsObj, mvDrawingEngine;
type
@ -30,7 +29,6 @@ type
CbMouseCoords: TGroupBox;
CbDistanceUnits: TComboBox;
CbDebugTiles: TCheckBox;
CbDrawingEngine: TComboBox;
CbShowPOIImage: TCheckBox;
cbPOITextBgColor: TColorBox;
FontDialog: TFontDialog;
@ -44,7 +42,6 @@ type
InfoBtnGPSPoints: TLabel;
GPSPointInfo: TLabel;
InfoViewportWidth: TLabel;
Label1: TLabel;
LblPOITextBgColor: TLabel;
LblSelectLocation: TLabel;
LblCenterLatitude: TLabel;
@ -73,7 +70,6 @@ type
procedure BtnSaveToFileClick(Sender: TObject);
procedure BtnPOITextFontClick(Sender: TObject);
procedure CbDebugTilesChange(Sender: TObject);
procedure CbDrawingEngineChange(Sender: TObject);
procedure CbDoubleBufferChange(Sender: TObject);
procedure CbFoundLocationsDrawItem(Control: TWinControl; Index: Integer;
ARect: TRect; State: TOwnerDrawState);
@ -100,8 +96,6 @@ type
procedure ZoomTrackBarChange(Sender: TObject);
private
FRGBGraphicsDrawingEngine: TMvRGBGraphicsDrawingEngine;
FBGRADrawingEngine: TMvBGRADrawingEngine;
POIImage: TCustomBitmap;
procedure ClearFoundLocations;
procedure UpdateCoords(X, Y: Integer);
@ -135,7 +129,7 @@ type
const
MAX_LOCATIONS_HISTORY = 50;
HOMEDIR = '';
HOMEDIR = '../../../'; // share the cache in both example projects
MAP_PROVIDER_FILENAME = 'map-providers.xml';
USE_DMS = true;
@ -252,23 +246,6 @@ begin
MapView.DebugTiles := CbDebugTiles.Checked;
end;
procedure TMainForm.CbDrawingEngineChange(Sender: TObject);
begin
case CbDrawingEngine.ItemIndex of
0: MapView.DrawingEngine := nil;
1: begin
if FRGBGraphicsDrawingEngine = nil then
FRGBGraphicsDrawingEngine := TMvRGBGraphicsDrawingEngine.Create(self);
MapView.DrawingEngine := FRGBGraphicsDrawingEngine;
end;
2: begin
if FBGRADrawingEngine = nil then
FBGRADrawingEngine := TMvBGRADrawingEngine.Create(self);
MapView.DrawingEngine := FBGRADrawingEngine;
end;
end;
end;
procedure TMainForm.CbDoubleBufferChange(Sender: TObject);
begin
MapView.DoubleBuffered := CbDoubleBuffer.Checked;
@ -351,8 +328,8 @@ begin
POIImage.PixelFormat := pf32bit;
POIImage.LoadFromFile('../../mapmarker.png');
ForceDirectories(HOMEDIR + 'cache/');
MapView.CachePath := HOMEDIR + 'cache/';
ForceDirectories(HOMEDIR + 'example_cache/');
MapView.CachePath := HOMEDIR + 'example_cache/';
MapView.GetMapProviders(CbProviders.Items);
CbProviders.ItemIndex := CbProviders.Items.Indexof(MapView.MapProvider);
MapView.DoubleBuffered := true;