LazMapViewer: Repeat incomplete previous commit.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8268 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2022-04-27 16:44:11 +00:00
parent 6b48ad28ce
commit 05745e2252

View File

@@ -134,11 +134,12 @@ type
const const
MAX_LOCATIONS_HISTORY = 50; MAX_LOCATIONS_HISTORY = 50;
MAP_PROVIDER_FILENAME = 'map-providers.xml'; MAP_PROVIDER_FILENAME = 'map-providers.xml';
HOMEDIR = '../../../../';
USE_DMS = true; USE_DMS = true;
var var
PointFormatSettings: TFormatsettings; PointFormatSettings: TFormatsettings;
CacheDir: String = '../../../../'; // share the cache in both example projects CacheDir: String = HOMEDIR + 'cache/'; // share the cache in both example projects
function CalcIniName: String; function CalcIniName: String;
@@ -340,7 +341,7 @@ begin
fn := Application.Location + 'mapmarker.png'; fn := Application.Location + 'mapmarker.png';
if not FileExists(fn) then if not FileExists(fn) then
MessageDlg('Copy the file "mapmarker.png" from the source to the app binary directory.', MessageDlg('Copy the file "mapmarker.png" from the source folder to the folder with the executable.',
mtError, [mbOK], 0) mtError, [mbOK], 0)
else else
begin begin
@@ -350,8 +351,13 @@ begin
POIImage.LoadFromFile(fn); POIImage.LoadFromFile(fn);
end; end;
ForceDirectories(HOMEDIR + 'cache/'); CacheDir := HOMEDIR + 'cache/';
MapView.CachePath := HOMEDIR + 'cache/'; if not ForceDirectories(CacheDir) then
begin
CacheDir := GetAppConfigDir(false) + 'cache/';
ForceDirectories(CacheDir);
end;
MapView.CachePath := CacheDir;
MapView.GetMapProviders(CbProviders.Items); MapView.GetMapProviders(CbProviders.Items);
CbProviders.ItemIndex := CbProviders.Items.Indexof(MapView.MapProvider); CbProviders.ItemIndex := CbProviders.Items.Indexof(MapView.MapProvider);
MapView.DoubleBuffered := true; MapView.DoubleBuffered := true;