LazMapviewer: Add TileID to parameters of OnDrawMissingTile event/plugin.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@9542 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz 2024-12-18 12:33:22 +00:00
parent 626917227d
commit 13ef68491a
5 changed files with 32 additions and 28 deletions

View File

@ -134,7 +134,8 @@ type
ADrawingEngine: TMvCustomDrawingEngine; APoint: TGPSPoint; var Handled: Boolean) of object;
TMvPluginDrawMissingTileEvent = procedure (Sender: TObject; AMapView: TMapView;
ADrawingEngine: TMvCustomDrawingEngine; const ARect: TRect; var Handled: Boolean) of object;
ADrawingEngine: TMvCustomDrawingEngine; ATileID: TTileID; ARect: TRect;
var Handled: Boolean) of object;
TMvPluginGPSItemsModifiedEvent = procedure (Sender: TObject; AMapView: TMapView;
ChangedList: TGPSObjectList; ActualObjs: TGPSObjList; Adding: Boolean;
@ -185,7 +186,7 @@ type
procedure DrawGPSPoint(AMapView: TMapView; ADrawingEngine: TMvCustomDrawingEngine;
APoint: TGPSPoint; var Handled: Boolean); override;
procedure DrawMissingTile(AMapView: TMapView; ADrawingEngine: TMvCustomDrawingEngine;
const ARect: TRect; var Handled: Boolean); override;
ATileID: TTileID; ARect: TRect; var Handled: Boolean); override;
procedure GPSItemsModified(AMapView: TMapView; ChangedList: TGPSObjectList;
ActualObjs: TGPSObjList; Adding: Boolean; var Handled: Boolean); override;
procedure MouseDown(AMapView: TMapView; Button: TMouseButton; Shift: TShiftState;
@ -698,10 +699,11 @@ begin
end;
procedure TUserDefinedPlugin.DrawMissingTile(AMapView: TMapView;
ADrawingEngine: TMvCustomDrawingEngine; const ARect: TRect; var Handled: Boolean);
ADrawingEngine: TMvCustomDrawingEngine; ATileID: TTileID; ARect: TRect;
var Handled: Boolean);
begin
if Assigned(FDrawMissingTileEvent) then
FDrawMissingTileEvent(Self, AMapView, ADrawingEngine, ARect, Handled);
FDrawMissingTileEvent(Self, AMapView, ADrawingEngine, ATileID, ARect, Handled);
end;
procedure TUserDefinedPlugin.GPSItemsModified(AMapView: TMapView;

View File

@ -15,17 +15,11 @@ unit mvMapProvider;
interface
uses
Classes, SysUtils, laz2_dom;
Classes, SysUtils, laz2_dom,
mvTypes;
type
{ TTileId }
TTileId = record
X, Y: int64;
Z: integer;
end;
TGetSvrStr = function (id: integer): string;
TGetValStr = function (const Tile: TTileId): String;
TProjectionType = (ptEPSG3857, ptEPSG3395);

View File

@ -39,7 +39,7 @@ Type
ADrawer: TMvCustomDrawingEngine; APoint: TGpsPoint) of object;
TDrawMissingTileEvent = procedure (Sender: TObject;
ADrawer: TMvCustomDrawingEngine; const ARect: TRect) of object;
ADrawer: TMvCustomDrawingEngine; ATileID: TTileID; ARect: TRect) of object;
TMapViewOption =
(
@ -452,7 +452,7 @@ type
function DrawGPSPoint(AMapView: TMapView; ADrawingEngine: TMvCustomDrawingEngine;
APoint: TGPSPoint): Boolean; virtual;
function DrawMissingTile(AMapView: TMapView; ADrawingEngine: TMvCustomDrawingEngine;
const ARect: TRect): Boolean; virtual;
ATileID: TTileID; ARect: TRect): Boolean; virtual;
function GPSItemsModified(AMapView: TMapView; ModifiedList: TGPSObjectList;
ActualObjs: TGPSObjList; Adding: Boolean): Boolean; virtual;
function MouseDown(AMapView: TMapView; AButton: TMouseButton; AShift: TShiftState;
@ -585,7 +585,7 @@ type
procedure DblClick; override;
procedure DoCenterMove(Sender: TObject);
procedure DoCenterMoving(Sender: TObject; var NewCenter: TRealPoint; var Allow: Boolean);
procedure DoDrawMissingTile(const ARect: TRect);
procedure DoDrawMissingTile(ATileID: TTileID; ARect: TRect);
procedure DoDrawPoint(const Area: TRealArea; APt: TGPSPoint; AImageIndex: Integer);
procedure DoDrawStretchedTile(const TileId: TTileID; X, Y: Integer; TileImg: TPictureCacheItem; const R: TRect);
procedure DoDrawTile(const TileId: TTileId; X,Y: integer; TileImg: TPictureCacheItem);
@ -3244,7 +3244,7 @@ begin
if Assigned(TileImg) then
DrawingEngine.DrawScaledCacheItem(Rect(X, Y, X + TileSize.CX, Y + TileSize.CY), R, TileImg)
else
DoDrawMissingTile(Rect(X, Y, X+TileSize.CX, Y+TileSize.CY));
DoDrawMissingTile(TileID, Rect(X, Y, X+TileSize.CX, Y+TileSize.CY));
if FDebugTiles then
DoDrawTileInfo(TileID, X, Y);
@ -3256,19 +3256,19 @@ begin
if Assigned(TileImg) then
DrawingEngine.DrawCacheItem(X, Y, TileImg)
else
DoDrawMissingTile(Rect(X, Y, X+TileSize.CX, Y+TileSize.CY));
DoDrawMissingTile(TileID, Rect(X, Y, X+TileSize.CX, Y+TileSize.CY));
if FDebugTiles then
DoDrawTileInfo(TileID, X, Y);
end;
procedure TMapView.DoDrawMissingTile(const ARect: TRect);
procedure TMapView.DoDrawMissingTile(ATileID: TTileID; ARect: TRect);
var
lHandled: Boolean;
begin
lHandled := PluginManager.DrawMissingTile(Self, DrawingEngine, ARect);
lHandled := PluginManager.DrawMissingTile(Self, DrawingEngine, ATileID, ARect);
if (not lHandled) and Assigned(FOnDrawMissingTile) then
FOnDrawMissingTile(Self, DrawingEngine, ARect)
FOnDrawMissingTile(Self, DrawingEngine, ATileID, ARect)
else
DrawingEngine.FillPixels(ARect.Left, ARect.Top, ARect.Right, ARect.Bottom, InactiveColor);
end;
@ -4449,9 +4449,10 @@ begin
end;
function TMvCustomPluginManager.DrawMissingTile(AMapView: TMapView;
ADrawingEngine: TMvCustomDrawingEngine; const ARect: TRect): Boolean;
ADrawingEngine: TMvCustomDrawingEngine; ATileID: TTileID; ARect: TRect): Boolean;
begin
Unused(AMapView, ADrawingEngine, ARect);
Unused(AMapView, ADrawingEngine);
Unused(ATileID, ARect);
Result := false;
end;

View File

@ -54,7 +54,7 @@ type
procedure DrawGPSPoint(AMapView: TMapView; ADrawingEngine: TMvCustomDrawingEngine;
APoint: TGPSPoint; var Handled: Boolean); virtual;
procedure DrawMissingTile(AMapView: TMapView; ADrawingEngine: TMvCustomDrawingEngine;
const ARect: TRect; var Handled: Boolean); virtual;
ATileID: TTileID; ARect: TRect; var Handled: Boolean); virtual;
procedure GPSItemsModified(AMapView: TMapView; ModifiedList: TGPSObjectList;
ActualObjs: TGPSObjList; Adding: Boolean; var Handled: Boolean); virtual;
procedure MouseDown(AMapView: TMapView; Button: TMouseButton; Shift: TShiftState;
@ -195,7 +195,7 @@ type
function DrawGPSPoint(AMapView: TMapView; ADrawingEngine: TMvCustomDrawingEngine;
APoint: TGPSPoint): Boolean; override;
function DrawMissingTile(AMapView: TMapView; ADrawingEngine: TMvCustomDrawingEngine;
const ARect: TRect): Boolean; override;
ATileID: TTileID; ARect: TRect): Boolean; override;
function GPSItemsModified(AMapView: TMapView; ModifiedList: TGPSObjectList;
ActualObjs: TGPSObjList; Adding: Boolean): Boolean; override;
function MouseDown(AMapView: TMapView; AButton: TMouseButton; AShift: TShiftState;
@ -316,10 +316,11 @@ begin
end;
procedure TMvCustomPlugin.DrawMissingTile(AMapView: TMapView;
ADrawingEngine: TMvCustomDrawingEngine; const ARect: TRect; var Handled: Boolean);
ADrawingEngine: TMvCustomDrawingEngine; ATileID: TTileID; ARect: TRect;
var Handled: Boolean);
begin
Unused(AMapView, Handled);
Unused(ADrawingEngine, ARect);
Unused(ADrawingEngine, ATileID, ARect);
end;
function TMvCustomPlugin.GetIndex: Integer;
@ -810,7 +811,7 @@ begin
end;
function TMvPluginManager.DrawMissingTile(AMapView: TMapView;
ADrawingEngine: TMvCustomDrawingEngine; const ARect: TRect): Boolean;
ADrawingEngine: TMvCustomDrawingEngine; ATileID: TTileID; ARect: TRect): Boolean;
var
i: Integer;
plugin: TMvCustomPlugin;
@ -820,7 +821,7 @@ begin
begin
plugin := Item[i];
if HandlePlugin(plugin, AMapView) then
plugin.DrawMissingTile(AMapView, ADrawingEngine, ARect, Result);
plugin.DrawMissingTile(AMapView, ADrawingEngine, ATileID, ARect, Result);
end;
end;

View File

@ -66,6 +66,12 @@ Type
function Union(const Area: TRealArea): TRealArea;
end;
{ TTileId }
TTileId = record
X, Y: int64;
Z: integer;
end;
function RealPoint(Lat, Lon: Double): TRealPoint;
// Call this to silence 'parameter is unused' hint