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

View File

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