diff --git a/components/lazmapviewer/source/addons/plugins/mvplugins.pas b/components/lazmapviewer/source/addons/plugins/mvplugins.pas index cbf737a66..8da82335a 100644 --- a/components/lazmapviewer/source/addons/plugins/mvplugins.pas +++ b/components/lazmapviewer/source/addons/plugins/mvplugins.pas @@ -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; diff --git a/components/lazmapviewer/source/mvmapprovider.pas b/components/lazmapviewer/source/mvmapprovider.pas index 481d9b1ee..3c479d350 100644 --- a/components/lazmapviewer/source/mvmapprovider.pas +++ b/components/lazmapviewer/source/mvmapprovider.pas @@ -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); diff --git a/components/lazmapviewer/source/mvmapviewer.pas b/components/lazmapviewer/source/mvmapviewer.pas index 19bed2f14..c2a412081 100644 --- a/components/lazmapviewer/source/mvmapviewer.pas +++ b/components/lazmapviewer/source/mvmapviewer.pas @@ -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; diff --git a/components/lazmapviewer/source/mvplugincore.pas b/components/lazmapviewer/source/mvplugincore.pas index 55788dce6..99b960bc2 100644 --- a/components/lazmapviewer/source/mvplugincore.pas +++ b/components/lazmapviewer/source/mvplugincore.pas @@ -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; diff --git a/components/lazmapviewer/source/mvtypes.pas b/components/lazmapviewer/source/mvtypes.pas index 0b1080541..1850277be 100644 --- a/components/lazmapviewer/source/mvtypes.pas +++ b/components/lazmapviewer/source/mvtypes.pas @@ -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