LazMapViewer: Add button to replace default POI image to fulldemo projects.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@9318 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz 2024-04-03 21:39:31 +00:00
parent 1b014e0d1b
commit a82bd5d98a
4 changed files with 125 additions and 37 deletions

View File

@ -1,10 +1,10 @@
object MainForm: TMainForm
Left = 381
Height = 589
Height = 586
Top = 187
Width = 750
Caption = 'LazMapViewer'
ClientHeight = 589
ClientHeight = 586
ClientWidth = 750
Font.Height = -12
ShowHint = True
@ -14,7 +14,7 @@ object MainForm: TMainForm
OnShow = FormShow
object MapView: TMapView
Left = 0
Height = 589
Height = 586
Top = 0
Width = 475
Align = alClient
@ -37,16 +37,16 @@ object MainForm: TMainForm
end
object PageControl: TPageControl
Left = 475
Height = 589
Height = 586
Top = 0
Width = 275
ActivePage = PgData
ActivePage = PgConfig
Align = alRight
TabIndex = 0
TabIndex = 2
TabOrder = 1
object PgData: TTabSheet
Caption = 'Data'
ClientHeight = 561
ClientHeight = 558
ClientWidth = 267
object ZoomTrackBar: TTrackBar
AnchorSideLeft.Control = PgData
@ -555,7 +555,7 @@ object MainForm: TMainForm
end
object PgLayers: TTabSheet
Caption = 'Layers'
ClientHeight = 561
ClientHeight = 558
ClientWidth = 267
object lblOpacity: TLabel
AnchorSideLeft.Control = Bevel2
@ -632,7 +632,7 @@ object MainForm: TMainForm
MinSize = 8
MaxSize = 166
Title.Caption = 'Provider'
Width = 154
Width = 166
end>
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goEditing, goSmoothScroll, goRowHighlight]
RowCount = 11
@ -643,7 +643,7 @@ object MainForm: TMainForm
ColWidths = (
30
54
154
166
)
Cells = (
11
@ -715,7 +715,7 @@ object MainForm: TMainForm
end
object PgConfig: TTabSheet
Caption = 'Config'
ClientHeight = 561
ClientHeight = 558
ClientWidth = 267
object LblProviders: TLabel
AnchorSideLeft.Control = CbProviders
@ -899,7 +899,7 @@ object MainForm: TMainForm
AnchorSideTop.Side = asrBottom
Left = 4
Height = 30
Top = 463
Top = 487
Width = 87
BorderSpacing.Top = 8
Caption = 'POI text font'
@ -914,7 +914,7 @@ object MainForm: TMainForm
AnchorSideRight.Side = asrBottom
Left = 142
Height = 21
Top = 468
Top = 492
Width = 119
NoneColorColor = clWhite
Style = [cbStandardColors, cbExtendedColors, cbIncludeNone, cbCustomColor, cbPrettyNames, cbCustomColors]
@ -931,7 +931,7 @@ object MainForm: TMainForm
AnchorSideTop.Side = asrCenter
Left = 97
Height = 15
Top = 471
Top = 495
Width = 39
BorderSpacing.Left = 6
Caption = 'Backgr.'
@ -955,23 +955,20 @@ object MainForm: TMainForm
AnchorSideTop.Control = Bevel1
AnchorSideTop.Side = asrBottom
Left = 4
Height = 104
Height = 128
Top = 351
Width = 159
AutoFill = True
AutoSize = True
Width = 233
AutoFill = False
BorderSpacing.Top = 6
Caption = 'POI Mode'
ChildSizing.LeftRightSpacing = 12
ChildSizing.TopBottomSpacing = 4
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
ChildSizing.EnlargeVertical = crsHomogenousChildResize
ChildSizing.ShrinkHorizontal = crsScaleChilds
ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ClientHeight = 84
ClientWidth = 155
ChildSizing.Layout = cclTopToBottomThenLeftToRight
ChildSizing.ControlsPerLine = 4
ClientHeight = 108
ClientWidth = 229
ItemIndex = 0
Items.Strings = (
'default drawing'
@ -981,6 +978,42 @@ object MainForm: TMainForm
)
TabOrder = 8
OnClick = rgPOIModeClick
object Bevel3: TBevel
Left = 151
Height = 25
Top = 4
Width = 66
Constraints.MaxHeight = 25
Shape = bsSpacer
end
object BtnSelectPOIImage: TButton
Left = 151
Height = 25
Top = 29
Width = 66
AutoSize = True
BorderSpacing.Left = 8
Caption = 'Select...'
Enabled = False
TabOrder = 5
OnClick = BtnSelectPOIImageClick
end
object Bevel4: TBevel
Left = 151
Height = 25
Top = 54
Width = 66
Constraints.MaxHeight = 25
Shape = bsSpacer
end
object Bevel5: TBevel
Left = 151
Height = 25
Top = 79
Width = 66
Constraints.MaxHeight = 25
Shape = bsSpacer
end
end
object CbZoomToCursor: TCheckBox
AnchorSideLeft.Control = PgConfig
@ -1642,8 +1675,12 @@ object MainForm: TMainForm
69754D32C924FBBF68FF0B9EFE66B6
}
end
object PrintDialog1: TPrintDialog
Left = 552
Top = 567
object PrintDialog: TPrintDialog
Left = 408
Top = 488
end
object OpenPictureDialog: TOpenPictureDialog
Left = 408
Top = 407
end
end

View File

@ -7,7 +7,7 @@ interface
uses
Classes, SysUtils, Types, Forms, Controls, Graphics, Dialogs, ExtCtrls,
StdCtrls, ComCtrls, Buttons, IntfGraphics, ColorBox, Spin, PrintersDlgs,
mvGeoNames, mvMapViewer, mvTypes, mvGpsObj, mvDrawingEngine, Grids;
mvGeoNames, mvMapViewer, mvTypes, mvGpsObj, mvDrawingEngine, Grids, ExtDlgs;
type
@ -15,6 +15,10 @@ type
TMainForm = class(TForm)
Bevel1: TBevel;
Bevel2: TBevel;
Bevel3: TBevel;
Bevel4: TBevel;
Bevel5: TBevel;
BtnSearch: TButton;
BtnGoTo: TButton;
BtnGPSPoints: TButton;
@ -22,10 +26,12 @@ type
BtnLoadGPXFile: TButton;
BtnPOITextFont: TButton;
BtnPrintMap: TButton;
BtnSelectPOIImage: TButton;
CbDoubleBuffer: TCheckBox;
CbFoundLocations: TComboBox;
CbLocations: TComboBox;
CbProviders: TComboBox;
OpenPictureDialog: TOpenPictureDialog;
PgLayers: TTabSheet;
rbSystemProxy: TRadioButton;
rbNoProxy: TRadioButton;
@ -79,7 +85,7 @@ type
PgData: TTabSheet;
PgConfig: TTabSheet;
POIImages: TImageList;
PrintDialog1: TPrintDialog;
PrintDialog: TPrintDialog;
rgPOIMode: TRadioGroup;
seProxyPort: TSpinEdit;
sgLayers: TStringGrid;
@ -94,6 +100,7 @@ type
procedure BtnGPSPointsClick(Sender: TObject);
procedure BtnSaveToFileClick(Sender: TObject);
procedure BtnPOITextFontClick(Sender: TObject);
procedure BtnSelectPOIImageClick(Sender: TObject);
procedure cbCyclicViewChange(Sender: TObject);
procedure CbDebugTilesChange(Sender: TObject);
procedure CbDoubleBufferChange(Sender: TObject);
@ -305,7 +312,7 @@ var
printedHeight_mm: Double;
factor: Double;
begin
if PrintDialog1.Execute then
if PrintDialog.Execute then
begin
Printer.Orientation := poPortrait;
@ -370,6 +377,17 @@ begin
end;
end;
procedure TMainForm.BtnSelectPOIImageClick(Sender: TObject);
begin
OpenPictureDialog.Filter := 'PNG files|*.png';
OpenPictureDialog.DefaultExt := '.png';
if OpenPictureDialog.Execute then
begin
POIImage.LoadFromFile(OpenPictureDialog.FileName);
MapView.POIImage.Assign(POIImage);
end;
end;
procedure TMainForm.cbCyclicViewChange(Sender: TObject);
begin
MapView.Cyclic := cbCyclicView.Checked;
@ -882,6 +900,7 @@ begin
MapView.OnDrawGPSPoint := @MapViewDrawGpsPoint;
end;
end;
BtnSelectPOIImage.Enabled := (rgPOIMode.ItemIndex = 1);
end;
procedure TMainForm.sgLayersCheckboxToggled(sender: TObject; aCol,

View File

@ -37,9 +37,9 @@ object MainForm: TMainForm
Height = 662
Top = 0
Width = 275
ActivePage = PgData
ActivePage = PgConfig
Align = alRight
TabIndex = 0
TabIndex = 2
TabOrder = 1
object PgData: TTabSheet
Caption = 'Data'
@ -1251,6 +1251,19 @@ object MainForm: TMainForm
OnChange = rbProxyChange
end
end
object BtnSelectPOIImage: TButton
AnchorSideLeft.Control = cbPOITextBgColor
AnchorSideTop.Control = CbShowPOIImage
AnchorSideTop.Side = asrCenter
Left = 156
Height = 25
Top = 472
Width = 75
Caption = 'Select...'
Enabled = False
TabOrder = 13
OnClick = BtnSelectPOIImageClick
end
end
end
object GeoNames: TMVGeoNames
@ -1267,7 +1280,11 @@ object MainForm: TMainForm
object FontDialog: TFontDialog
MinFontSize = 0
MaxFontSize = 0
Left = 736
Left = 600
Top = 544
end
object OpenPictureDialog: TOpenPictureDialog
Left = 600
Top = 488
end
end

View File

@ -5,10 +5,10 @@ unit Main;
interface
uses
Classes, SysUtils, Types, Forms, Controls, Graphics, Dialogs,
ExtCtrls, StdCtrls, ComCtrls, Buttons, IntfGraphics, ColorBox, Spin, Grids,
mvGeoNames, mvMapViewer, mvTypes, mvGpsObj, mvDrawingEngine,
mvDE_RGBGraphics, mvDE_BGRA, mvDLEFPC, mvDLEWin, mvDLESynapse;
Classes, SysUtils, Types, Forms, Controls, Graphics, Dialogs, ExtCtrls,
StdCtrls, ComCtrls, Buttons, IntfGraphics, ColorBox, Spin, Grids, ExtDlgs,
mvGeoNames, mvMapViewer, mvTypes, mvGpsObj, mvDrawingEngine, mvDE_RGBGraphics,
mvDE_BGRA, mvDLEFPC, mvDLEWin, mvDLESynapse;
type
@ -23,12 +23,14 @@ type
BtnSaveToFile: TButton;
BtnLoadGPXFile: TButton;
BtnPOITextFont: TButton;
BtnSelectPOIImage: TButton;
CbDoubleBuffer: TCheckBox;
CbDownloadEngine: TComboBox;
CbFoundLocations: TComboBox;
CbLocations: TComboBox;
CbProviders: TComboBox;
lblOpacity: TLabel;
OpenPictureDialog: TOpenPictureDialog;
rgDrawMode: TRadioGroup;
rbProxyData: TRadioButton;
rbSystemProxy: TRadioButton;
@ -96,6 +98,7 @@ type
procedure BtnGPSPointsClick(Sender: TObject);
procedure BtnSaveToFileClick(Sender: TObject);
procedure BtnPOITextFontClick(Sender: TObject);
procedure BtnSelectPOIImageClick(Sender: TObject);
procedure CbDebugTilesChange(Sender: TObject);
procedure CbDownloadEngineChange(Sender: TObject);
procedure CbDrawingEngineChange(Sender: TObject);
@ -348,6 +351,17 @@ begin
end;
end;
procedure TMainForm.BtnSelectPOIImageClick(Sender: TObject);
begin
OpenPictureDialog.Filter := 'PNG files|*.png';
OpenPictureDialog.DefaultExt := '.png';
if OpenPictureDialog.Execute then
begin
POIImage.LoadFromFile(OpenPictureDialog.FileName);
MapView.POIImage.Assign(POIImage);
end;
end;
procedure TMainForm.CbDebugTilesChange(Sender: TObject);
begin
MapView.DebugTiles := CbDebugTiles.Checked;
@ -454,6 +468,7 @@ begin
MapView.POIImage.Assign(POIImage)
else
MapView.POIImage.Clear;
BtnSelectPOIImage.Enabled := CbShowPOIImage.Checked;
MapView.Invalidate;
end;