lazMapViewer: Cosmetic changes

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6313 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz 2018-04-16 21:06:30 +00:00
parent 4aba8093da
commit 119046bcbc
4 changed files with 815 additions and 771 deletions

View File

@ -18,7 +18,7 @@ object MainForm: TMainForm
Align = alRight Align = alRight
ClientHeight = 545 ClientHeight = 545
ClientWidth = 237 ClientWidth = 237
TabOrder = 0 TabOrder = 1
object CbProviders: TComboBox object CbProviders: TComboBox
AnchorSideLeft.Control = LblProviders AnchorSideLeft.Control = LblProviders
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom

View File

@ -197,8 +197,6 @@ begin
MapView.Zoom := 1; MapView.Zoom := 1;
CbUseThreads.Checked := MapView.UseThreads; CbUseThreads.Checked := MapView.UseThreads;
CbDoubleBuffer.Checked := MapView.DoubleBuffered; CbDoubleBuffer.Checked := MapView.DoubleBuffered;
// GeoNames.LocationName := 'New York';
// MapView.Center := GeoNames.Search('New York', MapView.DownloadEngine);
ReadFromIni; ReadFromIni;
end; end;

File diff suppressed because it is too large Load Diff

View File

@ -38,29 +38,31 @@ Type
TMapProvider = Class TMapProvider = Class
private private
FLayer : integer; FLayer: integer;
idServer : Array of Integer; idServer: Array of Integer;
FName : String; FName: String;
FUrl : Array of string; FUrl: Array of string;
FNbSvr : Array of integer; FNbSvr: Array of integer;
FGetSvrStr : Array of TGetSvrStr; FGetSvrStr: Array of TGetSvrStr;
FGetXStr : Array of TGetValStr; FGetXStr: Array of TGetValStr;
FGetYStr : Array of TGetValStr; FGetYStr: Array of TGetValStr;
FGetZStr : Array of TGetValStr; FGetZStr: Array of TGetValStr;
FMinZoom : Array of integer; FMinZoom: Array of integer;
FMaxZoom : Array of integer; FMaxZoom: Array of integer;
function getLayerCount: integer; function GetLayerCount: integer;
procedure SetLayer(AValue: integer); procedure SetLayer(AValue: integer);
public public
constructor Create(aName : String); constructor Create(AName: String);
destructor Destroy; override; destructor Destroy; override;
procedure AddURL(Url: String; NbSvr: integer;aMinZoom : integer;aMaxZoom : integer; GetSvrStr: TGetSvrStr; GetXStr: TGetValStr; GetYStr: TGetValStr; GetZStr: TGetValStr); procedure AddURL(Url: String; NbSvr, aMinZoom, aMaxZoom: integer;
procedure GetZoomInfos(out zMin:integer;out zMax : integer); GetSvrStr: TGetSvrStr; GetXStr: TGetValStr; GetYStr: TGetValStr;
Function GetUrlForTile(id : TTileId) : String; GetZStr: TGetValStr);
property Name : String read FName; procedure GetZoomInfos(out AZoomMin, AZoomMax: integer);
property LayerCount : integer read getLayerCount; Function GetUrlForTile(id: TTileId): String;
property Layer : integer read FLayer write SetLayer; property Name: String read FName;
property LayerCount: integer read GetLayerCount;
property Layer: integer read FLayer write SetLayer;
end; end;
@ -131,41 +133,42 @@ begin
FLayer:=low(FUrl); FLayer:=low(FUrl);
end; end;
procedure TMapProvider.GetZoomInfos(out zMin: integer; out zMax: integer); procedure TMapProvider.GetZoomInfos(out AZoomMin, AZoomMax: integer);
begin begin
zMin:=FMinZoom[layer]; AZoomMin := FMinZoom[layer];
zMax:=FMaxZoom[layer]; AZoomMax := FMaxZoom[layer];
end; end;
function TMapProvider.GetUrlForTile(id: TTileId): String; function TMapProvider.GetUrlForTile(id: TTileId): String;
var i : integer; var
XVal,yVal,zVal,SvrVal : String; i: integer;
idsvr: integer; XVal, yVal, zVal, SvrVal: String;
idsvr: integer;
begin begin
Result:=''; Result := '';
i:=layer; i := layer;
if (i>high(idServer)) or (i<low(idServer)) or (FNbSvr[i]=0) then if (i > High(idServer)) or (i < Low(idServer)) or (FNbSvr[i] = 0) then
exit; exit;
idsvr:=idServer[i] mod FNbSvr[i]; idsvr := idServer[i] mod FNbSvr[i];
idServer[i]+=1; idServer[i] += 1;
SvrVal:=inttostr(idsvr); SvrVal := IntToStr(idsvr);
XVal:=inttostr(id.X); XVal := IntToStr(id.X);
YVal:=inttostr(id.Y); YVal := IntToStr(id.Y);
ZVal:=inttostr(id.Z); ZVal := IntToStr(id.Z);
if Assigned(FGetSvrStr[i]) then if Assigned(FGetSvrStr[i]) then
SvrVal:=FGetSvrStr[i](idsvr); SvrVal := FGetSvrStr[i](idsvr);
if Assigned(FGetXStr[i]) then if Assigned(FGetXStr[i]) then
XVal:=FGetXStr[i](id); XVal := FGetXStr[i](id);
if Assigned(FGetYStr[i]) then if Assigned(FGetYStr[i]) then
YVal:=FGetYStr[i](id); YVal := FGetYStr[i](id);
if Assigned(FGetZStr[i]) then if Assigned(FGetZStr[i]) then
ZVal:=FGetZStr[i](id); ZVal := FGetZStr[i](id);
Result:=StringReplace(FUrl[i],'%serv%',SvrVal,[rfreplaceall]); Result := StringReplace(FUrl[i], '%serv%', SvrVal, [rfreplaceall]);
Result:=StringReplace(Result,'%x%',XVal,[rfreplaceall]); Result := StringReplace(Result, '%x%', XVal, [rfreplaceall]);
Result:=StringReplace(Result,'%y%',YVal,[rfreplaceall]); Result := StringReplace(Result, '%y%', YVal, [rfreplaceall]);
Result:=StringReplace(Result,'%z%',ZVal,[rfreplaceall]); Result := StringReplace(Result, '%z%', ZVal, [rfreplaceall]);
end; end;
end. end.