You've already forked lazarus-ccr
LazMapViewer: Add DebugTiles property to show tile boundaries.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6922 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@@ -54,6 +54,7 @@ object MainForm: TMainForm
|
|||||||
end
|
end
|
||||||
object CbUseThreads: TCheckBox
|
object CbUseThreads: TCheckBox
|
||||||
AnchorSideLeft.Control = LblProviders
|
AnchorSideLeft.Control = LblProviders
|
||||||
|
AnchorSideTop.Control = CbDoubleBuffer
|
||||||
Left = 9
|
Left = 9
|
||||||
Height = 19
|
Height = 19
|
||||||
Top = 40
|
Top = 40
|
||||||
@@ -67,11 +68,14 @@ object MainForm: TMainForm
|
|||||||
object CbDoubleBuffer: TCheckBox
|
object CbDoubleBuffer: TCheckBox
|
||||||
AnchorSideLeft.Control = CbUseThreads
|
AnchorSideLeft.Control = CbUseThreads
|
||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
Left = 95
|
AnchorSideTop.Control = CbProviders
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
Left = 87
|
||||||
Height = 19
|
Height = 19
|
||||||
Top = 40
|
Top = 40
|
||||||
Width = 87
|
Width = 87
|
||||||
BorderSpacing.Left = 24
|
BorderSpacing.Left = 16
|
||||||
|
BorderSpacing.Top = 8
|
||||||
BorderSpacing.Right = 9
|
BorderSpacing.Right = 9
|
||||||
Caption = 'DblBuffering'
|
Caption = 'DblBuffering'
|
||||||
Checked = True
|
Checked = True
|
||||||
@@ -621,6 +625,19 @@ object MainForm: TMainForm
|
|||||||
OnClick = BtnLoadGPXFileClick
|
OnClick = BtnLoadGPXFileClick
|
||||||
TabOrder = 14
|
TabOrder = 14
|
||||||
end
|
end
|
||||||
|
object CbDebugTiles: TCheckBox
|
||||||
|
AnchorSideLeft.Control = CbDoubleBuffer
|
||||||
|
AnchorSideLeft.Side = asrBottom
|
||||||
|
AnchorSideTop.Control = CbDoubleBuffer
|
||||||
|
Left = 190
|
||||||
|
Height = 19
|
||||||
|
Top = 40
|
||||||
|
Width = 55
|
||||||
|
BorderSpacing.Left = 16
|
||||||
|
Caption = 'Debug'
|
||||||
|
OnChange = CbDebugTilesChange
|
||||||
|
TabOrder = 15
|
||||||
|
end
|
||||||
end
|
end
|
||||||
object MapView: TMapView
|
object MapView: TMapView
|
||||||
Left = 0
|
Left = 0
|
||||||
|
@@ -26,6 +26,7 @@ type
|
|||||||
CbUseThreads: TCheckBox;
|
CbUseThreads: TCheckBox;
|
||||||
CbMouseCoords: TGroupBox;
|
CbMouseCoords: TGroupBox;
|
||||||
CbDistanceUnits: TComboBox;
|
CbDistanceUnits: TComboBox;
|
||||||
|
CbDebugTiles: TCheckBox;
|
||||||
GbCenterCoords: TGroupBox;
|
GbCenterCoords: TGroupBox;
|
||||||
GbScreenSize: TGroupBox;
|
GbScreenSize: TGroupBox;
|
||||||
InfoCenterLatitude: TLabel;
|
InfoCenterLatitude: TLabel;
|
||||||
@@ -57,6 +58,7 @@ type
|
|||||||
procedure BtnSearchClick(Sender: TObject);
|
procedure BtnSearchClick(Sender: TObject);
|
||||||
procedure BtnGPSPointsClick(Sender: TObject);
|
procedure BtnGPSPointsClick(Sender: TObject);
|
||||||
procedure BtnSaveToFileClick(Sender: TObject);
|
procedure BtnSaveToFileClick(Sender: TObject);
|
||||||
|
procedure CbDebugTilesChange(Sender: TObject);
|
||||||
procedure CbDoubleBufferChange(Sender: TObject);
|
procedure CbDoubleBufferChange(Sender: TObject);
|
||||||
procedure CbFoundLocationsDrawItem(Control: TWinControl; Index: Integer;
|
procedure CbFoundLocationsDrawItem(Control: TWinControl; Index: Integer;
|
||||||
ARect: TRect; State: TOwnerDrawState);
|
ARect: TRect; State: TOwnerDrawState);
|
||||||
@@ -217,6 +219,11 @@ begin
|
|||||||
ShowMessage('Map saved to "mapview.png".');
|
ShowMessage('Map saved to "mapview.png".');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.CbDebugTilesChange(Sender: TObject);
|
||||||
|
begin
|
||||||
|
MapView.DebugTiles := CbDebugTiles.Checked;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TMainForm.CbDoubleBufferChange(Sender: TObject);
|
procedure TMainForm.CbDoubleBufferChange(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
MapView.DoubleBuffered := CbDoubleBuffer.Checked;
|
MapView.DoubleBuffered := CbDoubleBuffer.Checked;
|
||||||
|
@@ -60,6 +60,7 @@ Type
|
|||||||
FInactiveColor: TColor;
|
FInactiveColor: TColor;
|
||||||
FPOIImage: TBitmap;
|
FPOIImage: TBitmap;
|
||||||
FOnDrawGpsPoint: TDrawGpsPointEvent;
|
FOnDrawGpsPoint: TDrawGpsPointEvent;
|
||||||
|
FDebugTiles: Boolean;
|
||||||
FDefaultTrackColor: TColor;
|
FDefaultTrackColor: TColor;
|
||||||
FDefaultTrackWidth: Integer;
|
FDefaultTrackWidth: Integer;
|
||||||
procedure CallAsyncInvalidate;
|
procedure CallAsyncInvalidate;
|
||||||
@@ -81,6 +82,7 @@ Type
|
|||||||
procedure SetCacheOnDisk(AValue: boolean);
|
procedure SetCacheOnDisk(AValue: boolean);
|
||||||
procedure SetCachePath({%H-}AValue: String);
|
procedure SetCachePath({%H-}AValue: String);
|
||||||
procedure SetCenter(AValue: TRealPoint);
|
procedure SetCenter(AValue: TRealPoint);
|
||||||
|
procedure SetDebugTiles(AValue: Boolean);
|
||||||
procedure SetDefaultTrackColor(AValue: TColor);
|
procedure SetDefaultTrackColor(AValue: TColor);
|
||||||
procedure SetDefaultTrackWidth(AValue: Integer);
|
procedure SetDefaultTrackWidth(AValue: Integer);
|
||||||
procedure SetDownloadEngine(AValue: TMvCustomDownloadEngine);
|
procedure SetDownloadEngine(AValue: TMvCustomDownloadEngine);
|
||||||
@@ -100,7 +102,8 @@ Type
|
|||||||
out ACanvas: TFPCustomCanvas; AWidth, AHeight: Integer);
|
out ACanvas: TFPCustomCanvas; AWidth, AHeight: Integer);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
procedure DblClick; override;
|
procedure DblClick; override;
|
||||||
Procedure DoDrawTile(const TileId: TTileId; X,Y: integer; TileImg: TLazIntfImage);
|
procedure DoDrawTile(const TileId: TTileId; X,Y: integer; TileImg: TLazIntfImage);
|
||||||
|
procedure DoDrawTileInfo(const TileID: TTileID; X,Y: Integer);
|
||||||
function DoMouseWheel(Shift: TShiftState; WheelDelta: Integer;
|
function DoMouseWheel(Shift: TShiftState; WheelDelta: Integer;
|
||||||
MousePos: TPoint): Boolean; override;
|
MousePos: TPoint): Boolean; override;
|
||||||
procedure DoOnResize; override;
|
procedure DoOnResize; override;
|
||||||
@@ -136,6 +139,7 @@ Type
|
|||||||
property Align;
|
property Align;
|
||||||
property CacheOnDisk: boolean read GetCacheOnDisk write SetCacheOnDisk;
|
property CacheOnDisk: boolean read GetCacheOnDisk write SetCacheOnDisk;
|
||||||
property CachePath: String read GetCachePath write SetCachePath;
|
property CachePath: String read GetCachePath write SetCachePath;
|
||||||
|
property DebugTiles: Boolean read FDebugTiles write SetDebugTiles default false;
|
||||||
property DefaultTrackColor: TColor read FDefaultTrackColor write SetDefaultTrackColor default clRed;
|
property DefaultTrackColor: TColor read FDefaultTrackColor write SetDefaultTrackColor default clRed;
|
||||||
property DefaultTrackWidth: Integer read FDefaultTrackWidth write SetDefaultTrackWidth default 1;
|
property DefaultTrackWidth: Integer read FDefaultTrackWidth write SetDefaultTrackWidth default 1;
|
||||||
property DownloadEngine: TMvCustomDownloadEngine read GetDownloadEngine write SetDownloadEngine;
|
property DownloadEngine: TMvCustomDownloadEngine read GetDownloadEngine write SetDownloadEngine;
|
||||||
@@ -404,18 +408,25 @@ begin
|
|||||||
Engine.Center := AValue;
|
Engine.Center := AValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMapView.SetDebugTiles(AValue: Boolean);
|
||||||
|
begin
|
||||||
|
if FDebugTiles = AValue then exit;
|
||||||
|
FDebugTiles := AValue;
|
||||||
|
Engine.Redraw;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TMapView.SetDefaultTrackColor(AValue: TColor);
|
procedure TMapView.SetDefaultTrackColor(AValue: TColor);
|
||||||
begin
|
begin
|
||||||
if FDefaultTrackColor = AValue then exit;
|
if FDefaultTrackColor = AValue then exit;
|
||||||
FDefaultTrackColor := AValue;
|
FDefaultTrackColor := AValue;
|
||||||
Invalidate;
|
Engine.Redraw;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMapView.SetDefaultTrackWidth(AValue: Integer);
|
procedure TMapView.SetDefaultTrackWidth(AValue: Integer);
|
||||||
begin
|
begin
|
||||||
if FDefaultTrackWidth = AValue then exit;
|
if FDefaultTrackWidth = AValue then exit;
|
||||||
FDefaultTrackWidth := AValue;
|
FDefaultTrackWidth := AValue;
|
||||||
Invalidate;
|
Engine.Redraw;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMapView.SetDownloadEngine(AValue: TMvCustomDownloadEngine);
|
procedure TMapView.SetDownloadEngine(AValue: TMvCustomDownloadEngine);
|
||||||
@@ -766,9 +777,35 @@ begin
|
|||||||
end;
|
end;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
if FDebugTiles then
|
||||||
|
DoDrawTileInfo(TileID, X, Y);
|
||||||
DrawObjects(TileId, X, Y, X + TILE_SIZE, Y + TILE_SIZE);
|
DrawObjects(TileId, X, Y, X + TILE_SIZE, Y + TILE_SIZE);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMapView.DoDrawTileInfo(const TileID: TTileID; X, Y: Integer);
|
||||||
|
begin
|
||||||
|
{$IFDEF USE_LCL}
|
||||||
|
Buffer.Canvas.Pen.Color := clGray;
|
||||||
|
Buffer.Canvas.Pen.Style := psSolid;
|
||||||
|
Buffer.Canvas.Line(X, Y, X, Y + TILE_SIZE);
|
||||||
|
Buffer.Canvas.Line(X, Y, X + TILE_SIZE, Y);
|
||||||
|
Buffer.Canvas.Line(X + TILE_SIZE, Y, X + TILE_SIZE, Y + TILE_SIZE);
|
||||||
|
Buffer.Canvas.Line(X + TILE_SIZE, Y + TILE_SIZE, X, Y + TILE_SIZE);
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
{$IFDEF USE_RGBGRAPHICS}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
{$IFDEF USE_LAZINTFIMAGE}
|
||||||
|
BufferCanvas.Pen.FPColor := colGray;
|
||||||
|
BufferCanvas.Pen.Style := psSolid;
|
||||||
|
BufferCanvas.Line(X, Y, X, Y + TILE_SIZE);
|
||||||
|
BufferCanvas.Line(X, Y, X + TILE_SIZE, Y);
|
||||||
|
BufferCanvas.Line(X + TILE_SIZE, Y, X + TILE_SIZE, Y + TILE_SIZE);
|
||||||
|
BufferCanvas.Line(X, Y + TILE_SIZE, X + TILE_SIZE, Y + TILE_SIZE);
|
||||||
|
{$ENDIF}
|
||||||
|
end;
|
||||||
|
|
||||||
function TMapView.IsActive: Boolean;
|
function TMapView.IsActive: Boolean;
|
||||||
begin
|
begin
|
||||||
if not(csDesigning in ComponentState) then
|
if not(csDesigning in ComponentState) then
|
||||||
|
Reference in New Issue
Block a user