LazMapViewer: Add event and plugin hook for drawing missing tiles (OnDrawMissingTile). Issue #39086.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@9541 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
parent
79aeac4bb7
commit
626917227d
@ -130,6 +130,12 @@ type
|
||||
TMvPluginCenterMovingEvent = procedure (Sender: TObject; AMapView: TMapView;
|
||||
var ANewCenter: TRealPoint; var Allow, Handled: Boolean) of object;
|
||||
|
||||
TMvPluginDrawGPSPointEvent = procedure (Sender: TObject; AMapView: TMapView;
|
||||
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;
|
||||
|
||||
TMvPluginGPSItemsModifiedEvent = procedure (Sender: TObject; AMapView: TMapView;
|
||||
ChangedList: TGPSObjectList; ActualObjs: TGPSObjList; Adding: Boolean;
|
||||
var Handled: Boolean) of Object;
|
||||
@ -158,6 +164,8 @@ type
|
||||
FBeforeDrawObjectsEvent : TMvPluginNotifyEvent;
|
||||
FCenterMoveEvent : TMvPluginNotifyEvent;
|
||||
FCenterMovingEvent: TMvPluginCenterMovingEvent;
|
||||
FDrawGPSPointEvent: TMvPluginDrawGPSPointEvent;
|
||||
FDrawMissingTileEvent: TMvPluginDrawMissingTileEvent;
|
||||
FGPSItemsModifiedEvent : TMvPluginGPSItemsModifiedEvent;
|
||||
FMouseDownEvent : TMvPluginMouseEvent;
|
||||
FMouseEnterEvent : TMvPluginNotifyEvent;
|
||||
@ -174,6 +182,10 @@ type
|
||||
procedure CenterMove(AMapView: TMapView; var Handled: Boolean); override;
|
||||
procedure CenterMoving(AMapView: TMapView; var NewCenter: TRealPoint;
|
||||
var Allow, Handled: Boolean); override;
|
||||
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;
|
||||
procedure GPSItemsModified(AMapView: TMapView; ChangedList: TGPSObjectList;
|
||||
ActualObjs: TGPSObjList; Adding: Boolean; var Handled: Boolean); override;
|
||||
procedure MouseDown(AMapView: TMapView; Button: TMouseButton; Shift: TShiftState;
|
||||
@ -195,6 +207,7 @@ type
|
||||
property OnBeforeDrawObjects : TMvPluginNotifyEvent read FBeforeDrawObjectsEvent write FBeforeDrawObjectsEvent;
|
||||
property OnCenterMove : TMvPluginNotifyEvent read FCenterMoveEvent write FCenterMoveEvent;
|
||||
property OnCenterMoving: TMvPluginCenterMovingEvent read FCenterMovingEvent write FCenterMovingEvent;
|
||||
property OnDrawGPSPoint: TMvPluginDrawGPSPointEvent read FDrawGPSPointEvent write FDrawGPSPointEvent;
|
||||
property OnGPSItemsModified : TMvPluginGPSItemsModifiedEvent read FGPSItemsModifiedEvent write FGPSItemsModifiedEvent;
|
||||
property OnMouseDown : TMvPluginMouseEvent read FMouseDownEvent write FMouseDownEvent;
|
||||
property OnMouseEnter : TMvPluginNotifyEvent read FMouseEnterEvent write FMouseEnterEvent;
|
||||
@ -677,6 +690,20 @@ begin
|
||||
FCenterMovingEvent(Self, AMapView, NewCenter, Allow, Handled);
|
||||
end;
|
||||
|
||||
procedure TUserDefinedPlugin.DrawGPSPoint(AMapView: TMapView;
|
||||
ADrawingEngine: TMvCustomDrawingEngine; APoint: TGPSPoint; var Handled: Boolean);
|
||||
begin
|
||||
if Assigned(FDrawGPSPointEvent) then
|
||||
FDrawGPSPointEvent(Self, AMapView, ADrawingEngine, APoint, Handled);
|
||||
end;
|
||||
|
||||
procedure TUserDefinedPlugin.DrawMissingTile(AMapView: TMapView;
|
||||
ADrawingEngine: TMvCustomDrawingEngine; const ARect: TRect; var Handled: Boolean);
|
||||
begin
|
||||
if Assigned(FDrawMissingTileEvent) then
|
||||
FDrawMissingTileEvent(Self, AMapView, ADrawingEngine, ARect, Handled);
|
||||
end;
|
||||
|
||||
procedure TUserDefinedPlugin.GPSItemsModified(AMapView: TMapView;
|
||||
ChangedList: TGPSObjectList; ActualObjs: TGPSObjList; Adding: Boolean;
|
||||
var Handled: Boolean);
|
||||
|
@ -38,6 +38,9 @@ Type
|
||||
TDrawGpsPointEvent = procedure (Sender: TObject;
|
||||
ADrawer: TMvCustomDrawingEngine; APoint: TGpsPoint) of object;
|
||||
|
||||
TDrawMissingTileEvent = procedure (Sender: TObject;
|
||||
ADrawer: TMvCustomDrawingEngine; const ARect: TRect) of object;
|
||||
|
||||
TMapViewOption =
|
||||
(
|
||||
mvoEditorEnabled, // Point/Track editor enabled
|
||||
@ -446,6 +449,10 @@ type
|
||||
function CenterMove(AMapView: TMapView): Boolean; virtual;
|
||||
function CenterMoving(AMapView: TMapView; var NewCenter: TRealPoint;
|
||||
var Allow: Boolean): Boolean; virtual;
|
||||
function DrawGPSPoint(AMapView: TMapView; ADrawingEngine: TMvCustomDrawingEngine;
|
||||
APoint: TGPSPoint): Boolean; virtual;
|
||||
function DrawMissingTile(AMapView: TMapView; ADrawingEngine: TMvCustomDrawingEngine;
|
||||
const ARect: TRect): Boolean; virtual;
|
||||
function GPSItemsModified(AMapView: TMapView; ModifiedList: TGPSObjectList;
|
||||
ActualObjs: TGPSObjList; Adding: Boolean): Boolean; virtual;
|
||||
function MouseDown(AMapView: TMapView; AButton: TMouseButton; AShift: TShiftState;
|
||||
@ -473,11 +480,6 @@ type
|
||||
FBuiltinDownloadEngine: TMvCustomDownloadEngine;
|
||||
FBuiltinPluginManager: TMvCustomPluginManager;
|
||||
FPluginManager: TMvCustomPluginManager;
|
||||
FOnEditDrag: TNotifyEvent;
|
||||
FOnEditEndDrag: TNotifyEvent;
|
||||
FOnEditIsDirty: TNotifyEvent;
|
||||
FOnEditSelectionCompleted: TNotifyEvent;
|
||||
FOnEditStartDrag: TNotifyEvent;
|
||||
FEngine: TMapViewerEngine;
|
||||
FBuiltinDrawingEngine: TMvCustomDrawingEngine;
|
||||
FDrawingEngine: TMvCustomDrawingEngine;
|
||||
@ -488,7 +490,6 @@ type
|
||||
FOptions: TMapViewOptions;
|
||||
FPOIImage: TCustomBitmap;
|
||||
FPOITextBgColor: TColor;
|
||||
FOnDrawGpsPoint: TDrawGpsPointEvent;
|
||||
FDebugTiles: Boolean;
|
||||
FDefaultTrackColor: TColor;
|
||||
FDefaultTrackWidth: Integer;
|
||||
@ -500,6 +501,13 @@ type
|
||||
FZoomMin: Integer;
|
||||
FOnCenterMove: TNotifyEvent;
|
||||
FOnCenterMoving: TCenterMovingEvent;
|
||||
FOnDrawGpsPoint: TDrawGpsPointEvent;
|
||||
FOnDrawMissingTile: TDrawMissingTileEvent;
|
||||
FOnEditDrag: TNotifyEvent;
|
||||
FOnEditEndDrag: TNotifyEvent;
|
||||
FOnEditIsDirty: TNotifyEvent;
|
||||
FOnEditSelectionCompleted: TNotifyEvent;
|
||||
FOnEditStartDrag: TNotifyEvent;
|
||||
FOnZoomChange: TNotifyEvent;
|
||||
FOnZoomChanging: TZoomChangingEvent;
|
||||
FBeforeDrawObjectsEvent: TNotifyEvent;
|
||||
@ -577,6 +585,8 @@ type
|
||||
procedure DblClick; override;
|
||||
procedure DoCenterMove(Sender: TObject);
|
||||
procedure DoCenterMoving(Sender: TObject; var NewCenter: TRealPoint; var Allow: Boolean);
|
||||
procedure DoDrawMissingTile(const 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);
|
||||
procedure DoDrawTileInfo(const {%H-}TileID: TTileID; X,Y: Integer);
|
||||
@ -701,15 +711,16 @@ type
|
||||
property OnBeforeDrawObjects: TNotifyEvent read FBeforeDrawObjectsEvent write FBeforeDrawObjectsEvent;
|
||||
property OnCenterMove: TNotifyEvent read FOnCenterMove write FOnCenterMove;
|
||||
property OnCenterMoving: TCenterMovingEvent read FOnCenterMoving write FOnCenterMoving;
|
||||
property OnZoomChange: TNotifyEvent read FOnZoomChange write FOnZoomChange;
|
||||
property OnZoomChanging: TZoomChangingEvent read FOnZoomChanging write FOnZoomChanging;
|
||||
property OnChange: TNotifyEvent read GetOnChange write SetOnChange;
|
||||
property OnDrawGpsPoint: TDrawGpsPointEvent read FOnDrawGpsPoint write FOnDrawGpsPoint;
|
||||
property OnDrawMissingTile: TDrawMissingTileEvent read FOnDrawMissingTile write FOnDrawMissingTile;
|
||||
property OnEditSelectionCompleted: TNotifyEvent read FOnEditSelectionCompleted write FOnEditSelectionCompleted;
|
||||
property OnEditStartDrag: TNotifyEvent read FOnEditStartDrag write FOnEditStartDrag;
|
||||
property OnEditDrag: TNotifyEvent read FOnEditDrag write FOnEditDrag;
|
||||
property OnEditEndDrag: TNotifyEvent read FOnEditEndDrag write FOnEditEndDrag;
|
||||
property OnEditIsDirty: TNotifyEvent read FOnEditIsDirty write FOnEditIsDirty;
|
||||
property OnZoomChange: TNotifyEvent read FOnZoomChange write FOnZoomChange;
|
||||
property OnZoomChanging: TZoomChangingEvent read FOnZoomChanging write FOnZoomChanging;
|
||||
property OnMouseDown;
|
||||
property OnMouseEnter;
|
||||
property OnMouseLeave;
|
||||
@ -2587,11 +2598,11 @@ begin
|
||||
FDragger.MouseDown(FEditMark, X, Y);
|
||||
end
|
||||
// With editor enabled, dragging is with the middle button
|
||||
else if (Button = mbMiddle) and DraggingEnabled and
|
||||
(not lHandled) then
|
||||
else if (Button = mbMiddle) and DraggingEnabled and (not lHandled) then
|
||||
StartDragging(X, Y);
|
||||
end
|
||||
else
|
||||
begin
|
||||
// With editor disabled, dragging is with the left button
|
||||
if IsActive and DraggingEnabled and
|
||||
(Button = mbLeft) and (not lHandled) then
|
||||
@ -2599,6 +2610,7 @@ begin
|
||||
Engine.MouseDown(self,Button,Shift,X,Y);
|
||||
Invalidate;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMapView.MouseUp(Button: TMouseButton; Shift: TShiftState;
|
||||
@ -3039,34 +3051,38 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMapView.DrawPointOfInterest(const Area: TRealArea; APt: TGPSPointOfInterest);
|
||||
procedure TMapView.DoDrawPoint(const Area: TRealArea; APt: TGPSPoint; AImageIndex: Integer);
|
||||
var
|
||||
pt: TPoint;
|
||||
ptCyc: TPointArray;
|
||||
ptColor: TColor;
|
||||
extent: TSize;
|
||||
s: String;
|
||||
txt: String;
|
||||
txtExtent: TSize;
|
||||
bmp: TBitmap;
|
||||
w, h: Integer;
|
||||
OldOpacity: Single;
|
||||
OldPenStyle: TPenStyle;
|
||||
wBmp, hBmp: Integer;
|
||||
savedOpacity: Single;
|
||||
savedPen: TMvPen;
|
||||
|
||||
procedure DrawOne(pt: TPoint);
|
||||
procedure DrawOne(P: TPoint);
|
||||
const
|
||||
SYMBOL_SIZE = 5;
|
||||
begin
|
||||
// Draw as bitmap from ImageList...
|
||||
if Assigned(bmp) then
|
||||
DrawingEngine.DrawBitmap(pt.X - w div 2, pt.Y - h, bmp, true)
|
||||
DrawingEngine.DrawBitmap(P.X - wBmp div 2, P.Y - hBmp, bmp, true)
|
||||
else
|
||||
// ... or draw as global POI bitmap image ...
|
||||
if Assigned(FPOIImage) and not (FPOIImage.Empty) then
|
||||
DrawingEngine.DrawBitmap(P.X - FPOIImage.Width div 2, P.Y - FPOIImage.Height, FPOIImage, true)
|
||||
else
|
||||
// ... or as cross
|
||||
begin
|
||||
// ... or as cross
|
||||
ptColor := clRed;
|
||||
if (APt.ExtraData <> nil) and APt.ExtraData.InheritsFrom(TDrawingExtraData) then
|
||||
ptColor := TDrawingExtraData(APt.ExtraData).Color;
|
||||
DrawingEngine.PenColor := ptColor;
|
||||
DrawingEngine.PenWidth := 3;
|
||||
DrawingEngine.Line(pt.X, pt.Y - 5, pt.X, pt.Y + 5);
|
||||
DrawingEngine.Line(pt.X - 5, pt.Y, pt.X + 5, pt.Y);
|
||||
pt.Y := pt.Y + 5;
|
||||
DrawingEngine.Line(P.X, P.Y - SYMBOL_SIZE, P.X, P.Y + SYMBOL_SIZE);
|
||||
DrawingEngine.Line(P.X - SYMBOL_SIZE, P.Y, P.X + SYMBOL_SIZE, P.Y);
|
||||
P.Y := P.Y + 5; // distance to text
|
||||
end;
|
||||
|
||||
// Draw the point text
|
||||
if FPOITextBgColor = clNone then
|
||||
DrawingEngine.BrushStyle := bsClear
|
||||
else
|
||||
@ -3074,38 +3090,58 @@ var
|
||||
DrawingEngine.BrushStyle := bsSolid;
|
||||
DrawingEngine.BrushColor := FPOITextBgColor;
|
||||
end;
|
||||
DrawingEngine.TextOut(pt.X - extent.CX div 2, pt.Y + 5, s);
|
||||
DrawingEngine.TextOut(P.X - txtExtent.CX div 2, P.Y + 5, txt);
|
||||
end;
|
||||
|
||||
begin
|
||||
pt := Engine.LatLonToScreen(APt.RealPoint);
|
||||
// Custom-draw the point. Note that cyclic points must be handled in the event handler.
|
||||
if GetPluginManager.DrawGpsPoint(Self, DrawingEngine, APt) then
|
||||
exit;
|
||||
if Assigned(FOnDrawGpsPoint) then begin
|
||||
FOnDrawGpsPoint(Self, DrawingEngine, APt);
|
||||
exit;
|
||||
end;
|
||||
|
||||
OldOpacity := DrawingEngine.Opacity;
|
||||
OldPenStyle := DrawingEngine.PenStyle;
|
||||
bmp := Nil;
|
||||
savedOpacity := DrawingEngine.Opacity;
|
||||
savedPen := DrawingEngine.GetPen;
|
||||
bmp := nil;
|
||||
try
|
||||
DrawingEngine.Opacity := 1.0;
|
||||
DrawingEngine.PenStyle := psSolid;
|
||||
|
||||
// Draw point as symbol from image list ...
|
||||
if Assigned(FPOIImages) and (APt.ImageIndex <> -1) and (APt.ImageIndex < FPOIImages.Count) then
|
||||
// Prepare point image as symbol from image list ...
|
||||
if Assigned(FPOIImages) and (AImageIndex <> -1) and (AImageIndex < FPOIImages.Count) then
|
||||
begin
|
||||
bmp := TBitmap.Create;
|
||||
FPOIImages.GetBitmap(APt.ImageIndex, bmp);
|
||||
FPOIImages.GetBitmap(AImageIndex, bmp);
|
||||
{$IF LCL_FullVersion >= 2000000}
|
||||
w := FPOIImages.WidthForPPI[FPOIImagesWidth, Font.PixelsPerInch];
|
||||
h := FPOIImages.HeightForPPI[FPOIImagesWidth, Font.PixelsPerInch];
|
||||
wBmp := FPOIImages.WidthForPPI[FPOIImagesWidth, Font.PixelsPerInch];
|
||||
hBmp := FPOIImages.HeightForPPI[FPOIImagesWidth, Font.PixelsPerInch];
|
||||
{$ELSE}
|
||||
w := FPOIImages.Width;
|
||||
h := FPOIImages.Height;
|
||||
wBmp := FPOIImages.Width;
|
||||
hBmp := FPOIImages.Height;
|
||||
{$IFEND}
|
||||
end else
|
||||
begin
|
||||
// Otherwise prepare default point
|
||||
ptColor := clRed;
|
||||
if APt.ExtraData <> nil then
|
||||
begin
|
||||
if APt.ExtraData.InheritsFrom(TDrawingExtraData) then
|
||||
ptColor := TDrawingExtraData(APt.ExtraData).Color;
|
||||
end;
|
||||
DrawingEngine.PenStyle := psSolid;
|
||||
DrawingEngine.PenWidth := 3;
|
||||
DrawingEngine.PenColor := ptColor;
|
||||
end;
|
||||
|
||||
// Draw point text
|
||||
s := APt.Name;
|
||||
// Prepare point text
|
||||
txt := APt.Name;
|
||||
if FPOITextBgColor <> clNone then
|
||||
s := ' ' + s + ' ';
|
||||
extent := DrawingEngine.TextExtent(s);
|
||||
txt := ' ' + txt + ' '; // add some margin
|
||||
txtExtent := DrawingEngine.TextExtent(txt);
|
||||
|
||||
// Draw point, in case of cyclic points multiple times.
|
||||
pt := Engine.LatLonToScreen(APt.RealPoint);
|
||||
if Cyclic then
|
||||
begin
|
||||
ptCyc := CyclicPointsOf(pt);
|
||||
@ -3116,62 +3152,19 @@ begin
|
||||
DrawOne(pt);
|
||||
finally
|
||||
bmp.Free;
|
||||
DrawingEngine.Opacity := OldOpacity;
|
||||
DrawingEngine.PenStyle := OldPenStyle;
|
||||
DrawingEngine.Opacity := savedOpacity;
|
||||
DrawingEngine.SetPen(savedPen);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMapView.DrawPt(const Area: TRealArea; APt: TGPSPoint);
|
||||
var
|
||||
Pt: TPoint;
|
||||
PtCyc: TPointArray;
|
||||
PtColor: TColor;
|
||||
extent: TSize;
|
||||
s: String;
|
||||
|
||||
procedure DrawOne(Pt: TPoint);
|
||||
begin
|
||||
// Draw point marker
|
||||
if Assigned(FPOIImage) and not (FPOIImage.Empty) then
|
||||
DrawingEngine.DrawBitmap(Pt.X - FPOIImage.Width div 2, Pt.Y - FPOIImage.Height, FPOIImage, true)
|
||||
else begin
|
||||
DrawingEngine.PenColor := ptColor;
|
||||
DrawingEngine.PenWidth := 3;
|
||||
DrawingEngine.Line(Pt.X, Pt.Y - 5, Pt.X, Pt.Y + 5);
|
||||
DrawingEngine.Line(Pt.X - 5, Pt.Y, Pt.X + 5, Pt.Y);
|
||||
Pt.Y := Pt.Y + 5;
|
||||
end;
|
||||
|
||||
// Draw point text
|
||||
s := APt.Name;
|
||||
if FPOITextBgColor = clNone then
|
||||
DrawingEngine.BrushStyle := bsClear
|
||||
else begin
|
||||
DrawingEngine.BrushStyle := bsSolid;
|
||||
DrawingEngine.BrushColor := FPOITextBgColor;
|
||||
s := ' ' + s + ' ';
|
||||
end;
|
||||
extent := DrawingEngine.TextExtent(s);
|
||||
DrawingEngine.Textout(Pt.X - extent.CX div 2, Pt.Y + 5, s);
|
||||
end;
|
||||
|
||||
procedure TMapView.DrawPointOfInterest(const Area: TRealArea; APt: TGPSPointOfInterest);
|
||||
begin
|
||||
if Assigned(FOnDrawGpsPoint) then begin
|
||||
FOnDrawGpsPoint(Self, DrawingEngine, APt);
|
||||
exit;
|
||||
end;
|
||||
DoDrawPoint(ARea, APt, APt.ImageIndex);
|
||||
end;
|
||||
|
||||
Pt := Engine.LatLonToScreen(APt.RealPoint);
|
||||
PtColor := clRed;
|
||||
if APt.ExtraData <> nil then
|
||||
begin
|
||||
if APt.ExtraData.inheritsFrom(TDrawingExtraData) then
|
||||
PtColor := TDrawingExtraData(APt.ExtraData).Color;
|
||||
end;
|
||||
|
||||
PtCyc := CyclicPointsOf(Pt);
|
||||
for Pt in PtCyc do
|
||||
DrawOne(Pt);
|
||||
procedure TMapView.DrawPt(const Area: TRealArea; APt: TGPSPoint);
|
||||
begin
|
||||
DoDrawPoint(Area, APt, -1);
|
||||
end;
|
||||
|
||||
procedure TMapView.DrawGpsObj(const Area: TRealArea; AObj: TGPSObj);
|
||||
@ -3251,7 +3244,7 @@ begin
|
||||
if Assigned(TileImg) then
|
||||
DrawingEngine.DrawScaledCacheItem(Rect(X, Y, X + TileSize.CX, Y + TileSize.CY), R, TileImg)
|
||||
else
|
||||
DrawingEngine.FillPixels(X, Y, X + TileSize.CX, Y + TileSize.CY, InactiveColor);
|
||||
DoDrawMissingTile(Rect(X, Y, X+TileSize.CX, Y+TileSize.CY));
|
||||
|
||||
if FDebugTiles then
|
||||
DoDrawTileInfo(TileID, X, Y);
|
||||
@ -3263,13 +3256,24 @@ begin
|
||||
if Assigned(TileImg) then
|
||||
DrawingEngine.DrawCacheItem(X, Y, TileImg)
|
||||
else
|
||||
DrawingEngine.FillPixels(X, Y, X + TileSize.CX, Y + TileSize.CY, InactiveColor);
|
||||
DoDrawMissingTile(Rect(X, Y, X+TileSize.CX, Y+TileSize.CY));
|
||||
|
||||
if FDebugTiles then
|
||||
DoDrawTileInfo(TileID, X, Y);
|
||||
|
||||
end;
|
||||
|
||||
procedure TMapView.DoDrawMissingTile(const ARect: TRect);
|
||||
var
|
||||
lHandled: Boolean;
|
||||
begin
|
||||
lHandled := PluginManager.DrawMissingTile(Self, DrawingEngine, ARect);
|
||||
if (not lHandled) and Assigned(FOnDrawMissingTile) then
|
||||
FOnDrawMissingTile(Self, DrawingEngine, ARect)
|
||||
else
|
||||
DrawingEngine.FillPixels(ARect.Left, ARect.Top, ARect.Right, ARect.Bottom, InactiveColor);
|
||||
end;
|
||||
|
||||
|
||||
procedure TMapView.DoDrawTileInfo(const TileID: TTileID; X, Y: Integer);
|
||||
begin
|
||||
DrawingEngine.PenColor := clGray;
|
||||
@ -4437,6 +4441,20 @@ begin
|
||||
Result := false;
|
||||
end;
|
||||
|
||||
function TMvCustomPluginManager.DrawGPSPoint(AMapView: TMapView;
|
||||
ADrawingEngine: TMvCustomDrawingEngine; APoint: TGPSPoint): Boolean;
|
||||
begin
|
||||
Unused(AMapView, ADrawingEngine, APoint);
|
||||
Result := false;
|
||||
end;
|
||||
|
||||
function TMvCustomPluginManager.DrawMissingTile(AMapView: TMapView;
|
||||
ADrawingEngine: TMvCustomDrawingEngine; const ARect: TRect): Boolean;
|
||||
begin
|
||||
Unused(AMapView, ADrawingEngine, ARect);
|
||||
Result := false;
|
||||
end;
|
||||
|
||||
function TMvCustomPluginManager.GPSItemsModified(AMapView: TMapView;
|
||||
ModifiedList: TGPSObjectList; ActualObjs: TGPSObjList; Adding: Boolean): Boolean;
|
||||
begin
|
||||
|
@ -7,7 +7,7 @@ interface
|
||||
uses
|
||||
Classes, SysUtils, StrUtils, Contnrs, Math, LazLoggerBase,
|
||||
Graphics, Controls, Dialogs,
|
||||
mvMapViewer, mvTypes, mvGpsObj, mvClassRegistration;
|
||||
mvMapViewer, mvTypes, mvGpsObj, mvClassRegistration, mvDrawingEngine;
|
||||
|
||||
type
|
||||
TMvCustomPlugin = class;
|
||||
@ -51,6 +51,10 @@ type
|
||||
procedure CenterMove(AMapView: TMapView; var Handled: Boolean); virtual;
|
||||
procedure CenterMoving(AMapView: TMapView; var NewCenter: TRealPoint;
|
||||
var Allow, Handled: Boolean); virtual;
|
||||
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;
|
||||
procedure GPSItemsModified(AMapView: TMapView; ModifiedList: TGPSObjectList;
|
||||
ActualObjs: TGPSObjList; Adding: Boolean; var Handled: Boolean); virtual;
|
||||
procedure MouseDown(AMapView: TMapView; Button: TMouseButton; Shift: TShiftState;
|
||||
@ -188,6 +192,10 @@ type
|
||||
function CenterMove(AMapView: TMapView): Boolean; override;
|
||||
function CenterMoving(AMapView: TMapView; var NewCenter: TRealPoint;
|
||||
var Allow: Boolean): Boolean; override;
|
||||
function DrawGPSPoint(AMapView: TMapView; ADrawingEngine: TMvCustomDrawingEngine;
|
||||
APoint: TGPSPoint): Boolean; override;
|
||||
function DrawMissingTile(AMapView: TMapView; ADrawingEngine: TMvCustomDrawingEngine;
|
||||
const ARect: TRect): Boolean; override;
|
||||
function GPSItemsModified(AMapView: TMapView; ModifiedList: TGPSObjectList;
|
||||
ActualObjs: TGPSObjList; Adding: Boolean): Boolean; override;
|
||||
function MouseDown(AMapView: TMapView; AButton: TMouseButton; AShift: TShiftState;
|
||||
@ -300,6 +308,20 @@ begin
|
||||
Unused(NewCenter, Allow);
|
||||
end;
|
||||
|
||||
procedure TMvCustomPlugin.DrawGPSPoint(AMapView: TMapView;
|
||||
ADrawingEngine: TMvCustomDrawingEngine; APoint: TGPSPoint; var Handled: Boolean);
|
||||
begin
|
||||
Unused(AMapView, Handled);
|
||||
Unused(ADrawingEngine, APoint);
|
||||
end;
|
||||
|
||||
procedure TMvCustomPlugin.DrawMissingTile(AMapView: TMapView;
|
||||
ADrawingEngine: TMvCustomDrawingEngine; const ARect: TRect; var Handled: Boolean);
|
||||
begin
|
||||
Unused(AMapView, Handled);
|
||||
Unused(ADrawingEngine, ARect);
|
||||
end;
|
||||
|
||||
function TMvCustomPlugin.GetIndex: Integer;
|
||||
begin
|
||||
if FPluginManager = nil then
|
||||
@ -772,6 +794,36 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TMvPluginManager.DrawGPSPoint(AMapView: TMapView;
|
||||
ADrawingEngine: TMvCustomDrawingEngine; APoint: TGPSPoint): Boolean;
|
||||
var
|
||||
i: Integer;
|
||||
plugin: TMvCustomPlugin;
|
||||
begin
|
||||
Result := false;
|
||||
for i := 0 to FPluginList.Count-1 do
|
||||
begin
|
||||
plugin := Item[i];
|
||||
if HandlePlugin(plugin, AMapView) then
|
||||
plugin.DrawGPSPoint(AMapView, ADrawingEngine, APoint, Result);
|
||||
end;
|
||||
end;
|
||||
|
||||
function TMvPluginManager.DrawMissingTile(AMapView: TMapView;
|
||||
ADrawingEngine: TMvCustomDrawingEngine; const ARect: TRect): Boolean;
|
||||
var
|
||||
i: Integer;
|
||||
plugin: TMvCustomPlugin;
|
||||
begin
|
||||
Result := false;
|
||||
for i := 0 to FPluginList.Count-1 do
|
||||
begin
|
||||
plugin := Item[i];
|
||||
if HandlePlugin(plugin, AMapView) then
|
||||
plugin.DrawMissingTile(AMapView, ADrawingEngine, ARect, Result);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMvPluginManager.GetChildren(Proc: TGetChildProc; Root: TComponent);
|
||||
var
|
||||
plugin: TMvCustomPlugin;
|
||||
|
Loading…
Reference in New Issue
Block a user