LazMapViewer: Fix misc compilation and runtime errors.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@9545 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz 2024-12-18 20:07:56 +00:00
parent 58f351f6c9
commit 511902e32a
2 changed files with 33 additions and 4 deletions

View File

@ -31,6 +31,12 @@ type
Color: TColor;
end;
TMvPen = record
Style: TPenStyle;
Width: Integer;
Color: TColor;
end;
{ TMvCustomDrawingEngine }
TMvCustomDrawingEngine = class(TComponent)
@ -69,6 +75,7 @@ type
procedure FillPixels(X1, Y1, X2, Y2: Integer; AColor: TColor); virtual; abstract;
procedure FillRect(X1, Y1, X2, Y2: Integer); virtual; abstract;
function GetFont: TMvFont;
function GetPen: TMvPen;
procedure Line(X1, Y1, X2, Y2: Integer); virtual; abstract;
procedure Polyline(const Points: array of TPoint); virtual; abstract;
procedure Polygon(const Points: array of TPoint); virtual; abstract;
@ -80,6 +87,8 @@ type
function SaveToImage(AClass: TRasterImageClass): TRasterImage; virtual; abstract;
procedure SetFont(AFont: TMvFont);
procedure SetFont(AFontName: String; AFontSize: Integer; AFontStyle: TFontStyles; AFontColor: TColor);
procedure SetPen(APen: TMvPen);
procedure SetPen(APenStyle: TPenStyle; APenWidth: Integer; APenColor: TColor);
function TextExtent(const AText: String): TSize; virtual; abstract;
function TextHeight(const AText: String): Integer;
procedure TextOut(X, Y: Integer; const AText: String); virtual; abstract;
@ -590,6 +599,13 @@ begin
Result.Color := FontColor;
end;
function TMvCustomDrawingEngine.GetPen: TMvPen;
begin
Result.Style := PenStyle;
Result.Width := PenWidth;
Result.Color := PenColor;
end;
procedure TMvCustomDrawingEngine.PaintToCanvas(ACanvas: TCanvas);
begin
PaintToCanvas(ACanvas, Point(0, 0));
@ -609,6 +625,19 @@ begin
FontColor := AFontColor;
end;
procedure TMvCustomDrawingEngine.SetPen(APen: TMvPen);
begin
SetPen(APen.Style, APen.Width, APen.Color);
end;
procedure TMvCustomDrawingEngine.SetPen(APenStyle: TPenStyle;
APenWidth: Integer; APenColor: TColor);
begin
PenStyle := APenStyle;
PenWidth := APenWidth;
PenColor := APenColor;
end;
function TMvCustomDrawingEngine.TextHeight(const AText: String): Integer;
begin
Result := TextExtent(AText).CX;
@ -619,6 +648,5 @@ begin
Result := TextExtent(AText).CY;
end;
end.

View File

@ -27,7 +27,8 @@ interface
uses
Classes, SysUtils, Types, fgl, FPImage,
Controls, GraphType, Graphics, IntfGraphics,
LazFileUtils, GraphType,
Controls, Graphics, IntfGraphics,
Forms, ImgList, LCLVersion,
mvTypes, mvGeoMath, mvGPSObj, mvDragObj, mvCache, mvExtraData,
mvEngine, mvMapProvider, mvDownloadEngine, mvDrawingEngine;
@ -3253,7 +3254,7 @@ procedure TMapView.DoDrawMissingTile(ATileID: TTileID; ARect: TRect);
var
lHandled: Boolean;
begin
lHandled := PluginManager.DrawMissingTile(Self, DrawingEngine, ATileID, ARect);
lHandled := GetPluginManager.DrawMissingTile(Self, DrawingEngine, ATileID, ARect);
if (not lHandled) and Assigned(FOnDrawMissingTile) then
FOnDrawMissingTile(Self, DrawingEngine, ATileID, ARect)
else
@ -3805,7 +3806,7 @@ begin
clProfile: Result := Concat(GetUserDir, LazMVCacheFolder);
clTemp: Result := Concat(GetTempDir(True), LazMVCacheFolder);
otherwise
Result := ACustomPath;
Result := AppendPathDelim(ACustomPath);
end;
end;