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:
parent
626917227d
commit
13ef68491a
@ -134,7 +134,8 @@ type
|
|||||||
ADrawingEngine: TMvCustomDrawingEngine; APoint: TGPSPoint; var Handled: Boolean) of object;
|
ADrawingEngine: TMvCustomDrawingEngine; APoint: TGPSPoint; var Handled: Boolean) of object;
|
||||||
|
|
||||||
TMvPluginDrawMissingTileEvent = procedure (Sender: TObject; AMapView: TMapView;
|
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;
|
TMvPluginGPSItemsModifiedEvent = procedure (Sender: TObject; AMapView: TMapView;
|
||||||
ChangedList: TGPSObjectList; ActualObjs: TGPSObjList; Adding: Boolean;
|
ChangedList: TGPSObjectList; ActualObjs: TGPSObjList; Adding: Boolean;
|
||||||
@ -185,7 +186,7 @@ type
|
|||||||
procedure DrawGPSPoint(AMapView: TMapView; ADrawingEngine: TMvCustomDrawingEngine;
|
procedure DrawGPSPoint(AMapView: TMapView; ADrawingEngine: TMvCustomDrawingEngine;
|
||||||
APoint: TGPSPoint; var Handled: Boolean); override;
|
APoint: TGPSPoint; var Handled: Boolean); override;
|
||||||
procedure DrawMissingTile(AMapView: TMapView; ADrawingEngine: TMvCustomDrawingEngine;
|
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;
|
procedure GPSItemsModified(AMapView: TMapView; ChangedList: TGPSObjectList;
|
||||||
ActualObjs: TGPSObjList; Adding: Boolean; var Handled: Boolean); override;
|
ActualObjs: TGPSObjList; Adding: Boolean; var Handled: Boolean); override;
|
||||||
procedure MouseDown(AMapView: TMapView; Button: TMouseButton; Shift: TShiftState;
|
procedure MouseDown(AMapView: TMapView; Button: TMouseButton; Shift: TShiftState;
|
||||||
@ -698,10 +699,11 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TUserDefinedPlugin.DrawMissingTile(AMapView: TMapView;
|
procedure TUserDefinedPlugin.DrawMissingTile(AMapView: TMapView;
|
||||||
ADrawingEngine: TMvCustomDrawingEngine; const ARect: TRect; var Handled: Boolean);
|
ADrawingEngine: TMvCustomDrawingEngine; ATileID: TTileID; ARect: TRect;
|
||||||
|
var Handled: Boolean);
|
||||||
begin
|
begin
|
||||||
if Assigned(FDrawMissingTileEvent) then
|
if Assigned(FDrawMissingTileEvent) then
|
||||||
FDrawMissingTileEvent(Self, AMapView, ADrawingEngine, ARect, Handled);
|
FDrawMissingTileEvent(Self, AMapView, ADrawingEngine, ATileID, ARect, Handled);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TUserDefinedPlugin.GPSItemsModified(AMapView: TMapView;
|
procedure TUserDefinedPlugin.GPSItemsModified(AMapView: TMapView;
|
||||||
|
@ -15,17 +15,11 @@ unit mvMapProvider;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, laz2_dom;
|
Classes, SysUtils, laz2_dom,
|
||||||
|
mvTypes;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
{ TTileId }
|
|
||||||
|
|
||||||
TTileId = record
|
|
||||||
X, Y: int64;
|
|
||||||
Z: integer;
|
|
||||||
end;
|
|
||||||
|
|
||||||
TGetSvrStr = function (id: integer): string;
|
TGetSvrStr = function (id: integer): string;
|
||||||
TGetValStr = function (const Tile: TTileId): String;
|
TGetValStr = function (const Tile: TTileId): String;
|
||||||
TProjectionType = (ptEPSG3857, ptEPSG3395);
|
TProjectionType = (ptEPSG3857, ptEPSG3395);
|
||||||
|
@ -39,7 +39,7 @@ Type
|
|||||||
ADrawer: TMvCustomDrawingEngine; APoint: TGpsPoint) of object;
|
ADrawer: TMvCustomDrawingEngine; APoint: TGpsPoint) of object;
|
||||||
|
|
||||||
TDrawMissingTileEvent = procedure (Sender: TObject;
|
TDrawMissingTileEvent = procedure (Sender: TObject;
|
||||||
ADrawer: TMvCustomDrawingEngine; const ARect: TRect) of object;
|
ADrawer: TMvCustomDrawingEngine; ATileID: TTileID; ARect: TRect) of object;
|
||||||
|
|
||||||
TMapViewOption =
|
TMapViewOption =
|
||||||
(
|
(
|
||||||
@ -452,7 +452,7 @@ type
|
|||||||
function DrawGPSPoint(AMapView: TMapView; ADrawingEngine: TMvCustomDrawingEngine;
|
function DrawGPSPoint(AMapView: TMapView; ADrawingEngine: TMvCustomDrawingEngine;
|
||||||
APoint: TGPSPoint): Boolean; virtual;
|
APoint: TGPSPoint): Boolean; virtual;
|
||||||
function DrawMissingTile(AMapView: TMapView; ADrawingEngine: TMvCustomDrawingEngine;
|
function DrawMissingTile(AMapView: TMapView; ADrawingEngine: TMvCustomDrawingEngine;
|
||||||
const ARect: TRect): Boolean; virtual;
|
ATileID: TTileID; ARect: TRect): Boolean; virtual;
|
||||||
function GPSItemsModified(AMapView: TMapView; ModifiedList: TGPSObjectList;
|
function GPSItemsModified(AMapView: TMapView; ModifiedList: TGPSObjectList;
|
||||||
ActualObjs: TGPSObjList; Adding: Boolean): Boolean; virtual;
|
ActualObjs: TGPSObjList; Adding: Boolean): Boolean; virtual;
|
||||||
function MouseDown(AMapView: TMapView; AButton: TMouseButton; AShift: TShiftState;
|
function MouseDown(AMapView: TMapView; AButton: TMouseButton; AShift: TShiftState;
|
||||||
@ -585,7 +585,7 @@ type
|
|||||||
procedure DblClick; override;
|
procedure DblClick; override;
|
||||||
procedure DoCenterMove(Sender: TObject);
|
procedure DoCenterMove(Sender: TObject);
|
||||||
procedure DoCenterMoving(Sender: TObject; var NewCenter: TRealPoint; var Allow: Boolean);
|
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 DoDrawPoint(const Area: TRealArea; APt: TGPSPoint; AImageIndex: Integer);
|
||||||
procedure DoDrawStretchedTile(const TileId: TTileID; X, Y: Integer; TileImg: TPictureCacheItem; const R: TRect);
|
procedure DoDrawStretchedTile(const TileId: TTileID; X, Y: Integer; TileImg: TPictureCacheItem; const R: TRect);
|
||||||
procedure DoDrawTile(const TileId: TTileId; X,Y: integer; TileImg: TPictureCacheItem);
|
procedure DoDrawTile(const TileId: TTileId; X,Y: integer; TileImg: TPictureCacheItem);
|
||||||
@ -3244,7 +3244,7 @@ begin
|
|||||||
if Assigned(TileImg) then
|
if Assigned(TileImg) then
|
||||||
DrawingEngine.DrawScaledCacheItem(Rect(X, Y, X + TileSize.CX, Y + TileSize.CY), R, TileImg)
|
DrawingEngine.DrawScaledCacheItem(Rect(X, Y, X + TileSize.CX, Y + TileSize.CY), R, TileImg)
|
||||||
else
|
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
|
if FDebugTiles then
|
||||||
DoDrawTileInfo(TileID, X, Y);
|
DoDrawTileInfo(TileID, X, Y);
|
||||||
@ -3256,19 +3256,19 @@ begin
|
|||||||
if Assigned(TileImg) then
|
if Assigned(TileImg) then
|
||||||
DrawingEngine.DrawCacheItem(X, Y, TileImg)
|
DrawingEngine.DrawCacheItem(X, Y, TileImg)
|
||||||
else
|
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
|
if FDebugTiles then
|
||||||
DoDrawTileInfo(TileID, X, Y);
|
DoDrawTileInfo(TileID, X, Y);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMapView.DoDrawMissingTile(const ARect: TRect);
|
procedure TMapView.DoDrawMissingTile(ATileID: TTileID; ARect: TRect);
|
||||||
var
|
var
|
||||||
lHandled: Boolean;
|
lHandled: Boolean;
|
||||||
begin
|
begin
|
||||||
lHandled := PluginManager.DrawMissingTile(Self, DrawingEngine, ARect);
|
lHandled := PluginManager.DrawMissingTile(Self, DrawingEngine, ATileID, ARect);
|
||||||
if (not lHandled) and Assigned(FOnDrawMissingTile) then
|
if (not lHandled) and Assigned(FOnDrawMissingTile) then
|
||||||
FOnDrawMissingTile(Self, DrawingEngine, ARect)
|
FOnDrawMissingTile(Self, DrawingEngine, ATileID, ARect)
|
||||||
else
|
else
|
||||||
DrawingEngine.FillPixels(ARect.Left, ARect.Top, ARect.Right, ARect.Bottom, InactiveColor);
|
DrawingEngine.FillPixels(ARect.Left, ARect.Top, ARect.Right, ARect.Bottom, InactiveColor);
|
||||||
end;
|
end;
|
||||||
@ -4449,9 +4449,10 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TMvCustomPluginManager.DrawMissingTile(AMapView: TMapView;
|
function TMvCustomPluginManager.DrawMissingTile(AMapView: TMapView;
|
||||||
ADrawingEngine: TMvCustomDrawingEngine; const ARect: TRect): Boolean;
|
ADrawingEngine: TMvCustomDrawingEngine; ATileID: TTileID; ARect: TRect): Boolean;
|
||||||
begin
|
begin
|
||||||
Unused(AMapView, ADrawingEngine, ARect);
|
Unused(AMapView, ADrawingEngine);
|
||||||
|
Unused(ATileID, ARect);
|
||||||
Result := false;
|
Result := false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ type
|
|||||||
procedure DrawGPSPoint(AMapView: TMapView; ADrawingEngine: TMvCustomDrawingEngine;
|
procedure DrawGPSPoint(AMapView: TMapView; ADrawingEngine: TMvCustomDrawingEngine;
|
||||||
APoint: TGPSPoint; var Handled: Boolean); virtual;
|
APoint: TGPSPoint; var Handled: Boolean); virtual;
|
||||||
procedure DrawMissingTile(AMapView: TMapView; ADrawingEngine: TMvCustomDrawingEngine;
|
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;
|
procedure GPSItemsModified(AMapView: TMapView; ModifiedList: TGPSObjectList;
|
||||||
ActualObjs: TGPSObjList; Adding: Boolean; var Handled: Boolean); virtual;
|
ActualObjs: TGPSObjList; Adding: Boolean; var Handled: Boolean); virtual;
|
||||||
procedure MouseDown(AMapView: TMapView; Button: TMouseButton; Shift: TShiftState;
|
procedure MouseDown(AMapView: TMapView; Button: TMouseButton; Shift: TShiftState;
|
||||||
@ -195,7 +195,7 @@ type
|
|||||||
function DrawGPSPoint(AMapView: TMapView; ADrawingEngine: TMvCustomDrawingEngine;
|
function DrawGPSPoint(AMapView: TMapView; ADrawingEngine: TMvCustomDrawingEngine;
|
||||||
APoint: TGPSPoint): Boolean; override;
|
APoint: TGPSPoint): Boolean; override;
|
||||||
function DrawMissingTile(AMapView: TMapView; ADrawingEngine: TMvCustomDrawingEngine;
|
function DrawMissingTile(AMapView: TMapView; ADrawingEngine: TMvCustomDrawingEngine;
|
||||||
const ARect: TRect): Boolean; override;
|
ATileID: TTileID; ARect: TRect): Boolean; override;
|
||||||
function GPSItemsModified(AMapView: TMapView; ModifiedList: TGPSObjectList;
|
function GPSItemsModified(AMapView: TMapView; ModifiedList: TGPSObjectList;
|
||||||
ActualObjs: TGPSObjList; Adding: Boolean): Boolean; override;
|
ActualObjs: TGPSObjList; Adding: Boolean): Boolean; override;
|
||||||
function MouseDown(AMapView: TMapView; AButton: TMouseButton; AShift: TShiftState;
|
function MouseDown(AMapView: TMapView; AButton: TMouseButton; AShift: TShiftState;
|
||||||
@ -316,10 +316,11 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMvCustomPlugin.DrawMissingTile(AMapView: TMapView;
|
procedure TMvCustomPlugin.DrawMissingTile(AMapView: TMapView;
|
||||||
ADrawingEngine: TMvCustomDrawingEngine; const ARect: TRect; var Handled: Boolean);
|
ADrawingEngine: TMvCustomDrawingEngine; ATileID: TTileID; ARect: TRect;
|
||||||
|
var Handled: Boolean);
|
||||||
begin
|
begin
|
||||||
Unused(AMapView, Handled);
|
Unused(AMapView, Handled);
|
||||||
Unused(ADrawingEngine, ARect);
|
Unused(ADrawingEngine, ATileID, ARect);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TMvCustomPlugin.GetIndex: Integer;
|
function TMvCustomPlugin.GetIndex: Integer;
|
||||||
@ -810,7 +811,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TMvPluginManager.DrawMissingTile(AMapView: TMapView;
|
function TMvPluginManager.DrawMissingTile(AMapView: TMapView;
|
||||||
ADrawingEngine: TMvCustomDrawingEngine; const ARect: TRect): Boolean;
|
ADrawingEngine: TMvCustomDrawingEngine; ATileID: TTileID; ARect: TRect): Boolean;
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
plugin: TMvCustomPlugin;
|
plugin: TMvCustomPlugin;
|
||||||
@ -820,7 +821,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
plugin := Item[i];
|
plugin := Item[i];
|
||||||
if HandlePlugin(plugin, AMapView) then
|
if HandlePlugin(plugin, AMapView) then
|
||||||
plugin.DrawMissingTile(AMapView, ADrawingEngine, ARect, Result);
|
plugin.DrawMissingTile(AMapView, ADrawingEngine, ATileID, ARect, Result);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -66,6 +66,12 @@ Type
|
|||||||
function Union(const Area: TRealArea): TRealArea;
|
function Union(const Area: TRealArea): TRealArea;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TTileId }
|
||||||
|
TTileId = record
|
||||||
|
X, Y: int64;
|
||||||
|
Z: integer;
|
||||||
|
end;
|
||||||
|
|
||||||
function RealPoint(Lat, Lon: Double): TRealPoint;
|
function RealPoint(Lat, Lon: Double): TRealPoint;
|
||||||
|
|
||||||
// Call this to silence 'parameter is unused' hint
|
// Call this to silence 'parameter is unused' hint
|
||||||
|
Loading…
Reference in New Issue
Block a user