You've already forked lazarus-ccr
LazMapviewer: Extend the demo to provide an UI for changing how GPS points are displayed.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7460 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -33,7 +33,7 @@
|
|||||||
<PackageName Value="LCL"/>
|
<PackageName Value="LCL"/>
|
||||||
</Item2>
|
</Item2>
|
||||||
</RequiredPackages>
|
</RequiredPackages>
|
||||||
<Units Count="4">
|
<Units Count="5">
|
||||||
<Unit0>
|
<Unit0>
|
||||||
<Filename Value="MapViewer_Demo.lpr"/>
|
<Filename Value="MapViewer_Demo.lpr"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
@ -57,6 +57,13 @@
|
|||||||
<Filename Value="globals.pas"/>
|
<Filename Value="globals.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
</Unit3>
|
</Unit3>
|
||||||
|
<Unit4>
|
||||||
|
<Filename Value="gpsptform.pas"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
<ComponentName Value="GPSPointForm"/>
|
||||||
|
<HasResources Value="True"/>
|
||||||
|
<ResourceBaseClass Value="Form"/>
|
||||||
|
</Unit4>
|
||||||
</Units>
|
</Units>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
|
@ -5,7 +5,7 @@ program MapViewer_Demo;
|
|||||||
uses
|
uses
|
||||||
{$IFDEF UNIX}cthreads,{$ENDIF}
|
{$IFDEF UNIX}cthreads,{$ENDIF}
|
||||||
Interfaces, // this includes the LCL widgetset
|
Interfaces, // this includes the LCL widgetset
|
||||||
Forms, Main, gpslistform, globals
|
Forms, Main, gpslistform, globals, gpsptform
|
||||||
{ you can add units after this };
|
{ you can add units after this };
|
||||||
|
|
||||||
{$R *.res}
|
{$R *.res}
|
||||||
|
167
components/lazmapviewer/example/gpsptform.lfm
Normal file
167
components/lazmapviewer/example/gpsptform.lfm
Normal file
@ -0,0 +1,167 @@
|
|||||||
|
object GPSPointForm: TGPSPointForm
|
||||||
|
Left = 720
|
||||||
|
Height = 199
|
||||||
|
Top = 322
|
||||||
|
Width = 226
|
||||||
|
ActiveControl = edGPSPointLabel
|
||||||
|
AutoSize = True
|
||||||
|
BorderStyle = bsDialog
|
||||||
|
Caption = 'GPS Location'
|
||||||
|
ClientHeight = 199
|
||||||
|
ClientWidth = 226
|
||||||
|
OnShow = FormShow
|
||||||
|
LCLVersion = '2.1.0.0'
|
||||||
|
object ButtonPanel1: TButtonPanel
|
||||||
|
AnchorSideTop.Control = cbSymbols
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
Left = 6
|
||||||
|
Height = 34
|
||||||
|
Top = 159
|
||||||
|
Width = 214
|
||||||
|
Anchors = [akLeft, akRight]
|
||||||
|
OKButton.Name = 'OKButton'
|
||||||
|
OKButton.DefaultCaption = True
|
||||||
|
HelpButton.Name = 'HelpButton'
|
||||||
|
HelpButton.DefaultCaption = True
|
||||||
|
CloseButton.Name = 'CloseButton'
|
||||||
|
CloseButton.DefaultCaption = True
|
||||||
|
CancelButton.Name = 'CancelButton'
|
||||||
|
CancelButton.DefaultCaption = True
|
||||||
|
TabOrder = 1
|
||||||
|
ShowButtons = [pbOK, pbCancel]
|
||||||
|
end
|
||||||
|
object Panel1: TPanel
|
||||||
|
Left = 12
|
||||||
|
Height = 141
|
||||||
|
Top = 12
|
||||||
|
Width = 202
|
||||||
|
Align = alClient
|
||||||
|
AutoSize = True
|
||||||
|
BorderSpacing.Left = 12
|
||||||
|
BorderSpacing.Top = 12
|
||||||
|
BorderSpacing.Right = 12
|
||||||
|
BevelOuter = bvNone
|
||||||
|
ClientHeight = 141
|
||||||
|
ClientWidth = 202
|
||||||
|
TabOrder = 0
|
||||||
|
object Label1: TLabel
|
||||||
|
AnchorSideLeft.Control = Panel1
|
||||||
|
AnchorSideTop.Control = Panel1
|
||||||
|
Left = 0
|
||||||
|
Height = 15
|
||||||
|
Top = 0
|
||||||
|
Width = 104
|
||||||
|
Caption = 'Name of GPS point:'
|
||||||
|
ParentColor = False
|
||||||
|
end
|
||||||
|
object edGPSPointLabel: TEdit
|
||||||
|
AnchorSideLeft.Control = Label1
|
||||||
|
AnchorSideTop.Control = Label1
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
Left = 0
|
||||||
|
Height = 23
|
||||||
|
Top = 17
|
||||||
|
Width = 200
|
||||||
|
BorderSpacing.Top = 2
|
||||||
|
TabOrder = 0
|
||||||
|
end
|
||||||
|
object clbSymbolColor: TColorBox
|
||||||
|
AnchorSideLeft.Control = cbSymbols
|
||||||
|
AnchorSideTop.Control = edGPSPointLabel
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
AnchorSideRight.Control = edGPSPointLabel
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 51
|
||||||
|
Height = 22
|
||||||
|
Top = 44
|
||||||
|
Width = 149
|
||||||
|
Style = [cbStandardColors, cbExtendedColors, cbPrettyNames]
|
||||||
|
Anchors = [akTop, akLeft, akRight]
|
||||||
|
BorderSpacing.Top = 4
|
||||||
|
BorderSpacing.Bottom = 4
|
||||||
|
DropDownCount = 24
|
||||||
|
ItemHeight = 16
|
||||||
|
TabOrder = 1
|
||||||
|
end
|
||||||
|
object Label2: TLabel
|
||||||
|
AnchorSideLeft.Control = edGPSPointLabel
|
||||||
|
AnchorSideTop.Control = clbSymbolColor
|
||||||
|
AnchorSideTop.Side = asrCenter
|
||||||
|
Left = 0
|
||||||
|
Height = 15
|
||||||
|
Top = 48
|
||||||
|
Width = 32
|
||||||
|
BorderSpacing.Top = 8
|
||||||
|
Caption = 'Color:'
|
||||||
|
ParentColor = False
|
||||||
|
end
|
||||||
|
object lblSymbol: TLabel
|
||||||
|
AnchorSideLeft.Control = edGPSPointLabel
|
||||||
|
AnchorSideTop.Control = cbSymbols
|
||||||
|
AnchorSideTop.Side = asrCenter
|
||||||
|
Left = 0
|
||||||
|
Height = 15
|
||||||
|
Top = 101
|
||||||
|
Width = 43
|
||||||
|
BorderSpacing.Top = 8
|
||||||
|
Caption = 'Symbol:'
|
||||||
|
ParentColor = False
|
||||||
|
end
|
||||||
|
object cbSymbols: TComboBox
|
||||||
|
AnchorSideLeft.Control = lblSymbol
|
||||||
|
AnchorSideLeft.Side = asrBottom
|
||||||
|
AnchorSideTop.Control = seSize
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
AnchorSideRight.Control = edGPSPointLabel
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 51
|
||||||
|
Height = 23
|
||||||
|
Top = 97
|
||||||
|
Width = 149
|
||||||
|
Anchors = [akTop, akLeft, akRight]
|
||||||
|
BorderSpacing.Left = 8
|
||||||
|
BorderSpacing.Top = 4
|
||||||
|
ItemHeight = 15
|
||||||
|
ItemIndex = 0
|
||||||
|
Items.Strings = (
|
||||||
|
'plus ( + )'
|
||||||
|
'corss (⛌)'
|
||||||
|
'filled circle (⚫)'
|
||||||
|
'open circle (⚪)'
|
||||||
|
'filled square (■)'
|
||||||
|
'open square (□)'
|
||||||
|
)
|
||||||
|
Style = csDropDownList
|
||||||
|
TabOrder = 3
|
||||||
|
Text = 'plus ( + )'
|
||||||
|
end
|
||||||
|
object lblSize: TLabel
|
||||||
|
AnchorSideLeft.Control = edGPSPointLabel
|
||||||
|
AnchorSideTop.Control = seSize
|
||||||
|
AnchorSideTop.Side = asrCenter
|
||||||
|
Left = 0
|
||||||
|
Height = 15
|
||||||
|
Top = 74
|
||||||
|
Width = 20
|
||||||
|
Caption = 'Size'
|
||||||
|
ParentColor = False
|
||||||
|
end
|
||||||
|
object seSize: TSpinEdit
|
||||||
|
AnchorSideLeft.Control = cbSymbols
|
||||||
|
AnchorSideTop.Control = clbSymbolColor
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
AnchorSideRight.Control = clbSymbolColor
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 51
|
||||||
|
Height = 23
|
||||||
|
Top = 70
|
||||||
|
Width = 149
|
||||||
|
Alignment = taRightJustify
|
||||||
|
Anchors = [akTop, akLeft, akRight]
|
||||||
|
MaxValue = 50
|
||||||
|
MinValue = 1
|
||||||
|
TabOrder = 2
|
||||||
|
Value = 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
87
components/lazmapviewer/example/gpsptform.pas
Normal file
87
components/lazmapviewer/example/gpsptform.pas
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
unit gpsptform;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls,
|
||||||
|
ButtonPanel, ColorBox, Spin, mvExtraData;
|
||||||
|
|
||||||
|
type
|
||||||
|
|
||||||
|
TGPSSymbol = (gpsPlus, gpsCross, gpsFilledCircle, gpsOpenCircle,
|
||||||
|
gpsFilledRect, gpsOpenRect);
|
||||||
|
|
||||||
|
TGPSExtraData = class(TDrawingExtraData)
|
||||||
|
private
|
||||||
|
FSymbol: TGPSSymbol;
|
||||||
|
FSize: Integer;
|
||||||
|
public
|
||||||
|
constructor Create(aID: Integer); override;
|
||||||
|
property Symbol: TGPSSymbol read FSymbol write FSymbol;
|
||||||
|
property Size: Integer read FSize write FSize;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TGPSPointForm }
|
||||||
|
|
||||||
|
TGPSPointForm = class(TForm)
|
||||||
|
ButtonPanel1: TButtonPanel;
|
||||||
|
clbSymbolColor: TColorBox;
|
||||||
|
cbSymbols: TComboBox;
|
||||||
|
edGPSPointLabel: TEdit;
|
||||||
|
Label1: TLabel;
|
||||||
|
Label2: TLabel;
|
||||||
|
lblSymbol: TLabel;
|
||||||
|
lblSize: TLabel;
|
||||||
|
Panel1: TPanel;
|
||||||
|
seSize: TSpinEdit;
|
||||||
|
procedure FormShow(Sender: TObject);
|
||||||
|
private
|
||||||
|
|
||||||
|
public
|
||||||
|
procedure GetData(var AName: String; var AColor: TColor;
|
||||||
|
var ASymbol: TGPSSymbol; var ASize: Integer);
|
||||||
|
procedure SetData(const AName: String; AColor: TColor;
|
||||||
|
ASymbol: TGPSSymbol; ASize: Integer);
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
GPSPointForm: TGPSPointForm;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
{$R *.lfm}
|
||||||
|
|
||||||
|
constructor TGPSExtraData.Create(aID: Integer);
|
||||||
|
begin
|
||||||
|
inherited Create(aID);
|
||||||
|
FSymbol := gpsPlus;
|
||||||
|
FSize := 10;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TGPSPointForm.FormShow(Sender: TObject);
|
||||||
|
begin
|
||||||
|
edGPSPointLabel.SetFocus;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TGPSPointForm.GetData(var AName: String; var AColor: TColor;
|
||||||
|
var ASymbol: TGPSSymbol; var ASize: Integer);
|
||||||
|
begin
|
||||||
|
AName := edGPSPointLabel.Text;
|
||||||
|
AColor := clbSymbolColor.Selected;
|
||||||
|
ASymbol := TGPSSymbol(cbSymbols.ItemIndex);
|
||||||
|
ASize := seSize.Value;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TGPSPointForm.Setdata(const AName: String; AColor: TColor;
|
||||||
|
ASymbol: TGPSSymbol; ASize: Integer);
|
||||||
|
begin
|
||||||
|
edGPSPointLabel.Text := AName;
|
||||||
|
clbSymbolColor.Selected := AColor;
|
||||||
|
cbSymbols.ItemIndex := ord(ASymbol);
|
||||||
|
seSize.Value := ASize
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
@ -476,13 +476,13 @@ object MainForm: TMainForm
|
|||||||
AnchorSideTop.Control = BtnGPSPoints
|
AnchorSideTop.Control = BtnGPSPoints
|
||||||
AnchorSideRight.Control = BtnGPSPoints
|
AnchorSideRight.Control = BtnGPSPoints
|
||||||
Left = 8
|
Left = 8
|
||||||
Height = 30
|
Height = 45
|
||||||
Top = 4
|
Top = 4
|
||||||
Width = 178
|
Width = 178
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
BorderSpacing.Left = 8
|
BorderSpacing.Left = 8
|
||||||
BorderSpacing.Top = 4
|
BorderSpacing.Top = 4
|
||||||
Caption = 'Click with right mouse button to add a GPS point.'
|
Caption = 'Click with right mouse button to add a GPS point.'#13#10'Settings on page "Config".'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
WordWrap = True
|
WordWrap = True
|
||||||
end
|
end
|
||||||
@ -495,8 +495,8 @@ object MainForm: TMainForm
|
|||||||
AnchorSideBottom.Control = GbGPS
|
AnchorSideBottom.Control = GbGPS
|
||||||
AnchorSideBottom.Side = asrBottom
|
AnchorSideBottom.Side = asrBottom
|
||||||
Left = 8
|
Left = 8
|
||||||
Height = 35
|
Height = 20
|
||||||
Top = 50
|
Top = 65
|
||||||
Width = 237
|
Width = 237
|
||||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||||
AutoSize = False
|
AutoSize = False
|
||||||
@ -716,32 +716,18 @@ object MainForm: TMainForm
|
|||||||
OnChange = CbDebugTilesChange
|
OnChange = CbDebugTilesChange
|
||||||
TabOrder = 3
|
TabOrder = 3
|
||||||
end
|
end
|
||||||
object CbShowPOIImage: TCheckBox
|
|
||||||
AnchorSideLeft.Control = CbDebugTiles
|
|
||||||
AnchorSideTop.Control = Bevel1
|
|
||||||
AnchorSideTop.Side = asrBottom
|
|
||||||
Left = 6
|
|
||||||
Height = 19
|
|
||||||
Top = 143
|
|
||||||
Width = 107
|
|
||||||
BorderSpacing.Top = 6
|
|
||||||
Caption = 'Show POI image'
|
|
||||||
OnChange = CbShowPOIImageChange
|
|
||||||
TabOrder = 4
|
|
||||||
end
|
|
||||||
object BtnPOITextFont: TButton
|
object BtnPOITextFont: TButton
|
||||||
AnchorSideLeft.Control = CbShowPOIImage
|
AnchorSideTop.Control = rgPOIMode
|
||||||
AnchorSideTop.Control = CbShowPOIImage
|
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 6
|
Left = 16
|
||||||
Height = 25
|
Height = 25
|
||||||
Top = 170
|
Top = 230
|
||||||
Width = 93
|
Width = 93
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
BorderSpacing.Top = 8
|
BorderSpacing.Top = 8
|
||||||
Caption = 'POI text font'
|
Caption = 'POI text font'
|
||||||
OnClick = BtnPOITextFontClick
|
OnClick = BtnPOITextFontClick
|
||||||
TabOrder = 5
|
TabOrder = 4
|
||||||
end
|
end
|
||||||
object cbPOITextBgColor: TColorBox
|
object cbPOITextBgColor: TColorBox
|
||||||
AnchorSideLeft.Control = LblPOITextBgColor
|
AnchorSideLeft.Control = LblPOITextBgColor
|
||||||
@ -749,26 +735,26 @@ object MainForm: TMainForm
|
|||||||
AnchorSideTop.Control = BtnPOITextFont
|
AnchorSideTop.Control = BtnPOITextFont
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 154
|
Left = 164
|
||||||
Height = 22
|
Height = 22
|
||||||
Top = 171
|
Top = 231
|
||||||
Width = 107
|
Width = 97
|
||||||
NoneColorColor = clWhite
|
NoneColorColor = clWhite
|
||||||
Style = [cbStandardColors, cbExtendedColors, cbIncludeNone, cbCustomColor, cbPrettyNames, cbCustomColors]
|
Style = [cbStandardColors, cbExtendedColors, cbIncludeNone, cbCustomColor, cbPrettyNames, cbCustomColors]
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
BorderSpacing.Left = 8
|
BorderSpacing.Left = 8
|
||||||
ItemHeight = 16
|
ItemHeight = 16
|
||||||
OnChange = cbPOITextBgColorChange
|
OnChange = cbPOITextBgColorChange
|
||||||
TabOrder = 6
|
TabOrder = 5
|
||||||
end
|
end
|
||||||
object LblPOITextBgColor: TLabel
|
object LblPOITextBgColor: TLabel
|
||||||
AnchorSideLeft.Control = BtnPOITextFont
|
AnchorSideLeft.Control = BtnPOITextFont
|
||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideTop.Control = BtnPOITextFont
|
AnchorSideTop.Control = BtnPOITextFont
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
Left = 107
|
Left = 117
|
||||||
Height = 15
|
Height = 15
|
||||||
Top = 175
|
Top = 235
|
||||||
Width = 39
|
Width = 39
|
||||||
BorderSpacing.Left = 8
|
BorderSpacing.Left = 8
|
||||||
Caption = 'Backgr.'
|
Caption = 'Backgr.'
|
||||||
@ -787,6 +773,36 @@ object MainForm: TMainForm
|
|||||||
BorderSpacing.Top = 8
|
BorderSpacing.Top = 8
|
||||||
Shape = bsTopLine
|
Shape = bsTopLine
|
||||||
end
|
end
|
||||||
|
object rgPOIMode: TRadioGroup
|
||||||
|
AnchorSideLeft.Control = CbProviders
|
||||||
|
AnchorSideTop.Control = Bevel1
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
Left = 6
|
||||||
|
Height = 77
|
||||||
|
Top = 145
|
||||||
|
Width = 143
|
||||||
|
AutoFill = True
|
||||||
|
AutoSize = True
|
||||||
|
BorderSpacing.Top = 8
|
||||||
|
Caption = 'POI Mode'
|
||||||
|
ChildSizing.LeftRightSpacing = 12
|
||||||
|
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
|
||||||
|
ChildSizing.EnlargeVertical = crsHomogenousChildResize
|
||||||
|
ChildSizing.ShrinkHorizontal = crsScaleChilds
|
||||||
|
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||||
|
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||||
|
ChildSizing.ControlsPerLine = 1
|
||||||
|
ClientHeight = 57
|
||||||
|
ClientWidth = 139
|
||||||
|
ItemIndex = 0
|
||||||
|
Items.Strings = (
|
||||||
|
'default drawing'
|
||||||
|
'default POI image'
|
||||||
|
'custom drawing'
|
||||||
|
)
|
||||||
|
OnClick = rgPOIModeClick
|
||||||
|
TabOrder = 6
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
object GeoNames: TMVGeoNames
|
object GeoNames: TMVGeoNames
|
||||||
|
@ -29,7 +29,6 @@ type
|
|||||||
CbMouseCoords: TGroupBox;
|
CbMouseCoords: TGroupBox;
|
||||||
CbDistanceUnits: TComboBox;
|
CbDistanceUnits: TComboBox;
|
||||||
CbDebugTiles: TCheckBox;
|
CbDebugTiles: TCheckBox;
|
||||||
CbShowPOIImage: TCheckBox;
|
|
||||||
cbPOITextBgColor: TColorBox;
|
cbPOITextBgColor: TColorBox;
|
||||||
FontDialog: TFontDialog;
|
FontDialog: TFontDialog;
|
||||||
GbCenterCoords: TGroupBox;
|
GbCenterCoords: TGroupBox;
|
||||||
@ -62,6 +61,7 @@ type
|
|||||||
PageControl: TPageControl;
|
PageControl: TPageControl;
|
||||||
PgData: TTabSheet;
|
PgData: TTabSheet;
|
||||||
PgConfig: TTabSheet;
|
PgConfig: TTabSheet;
|
||||||
|
rgPOIMode: TRadioGroup;
|
||||||
ZoomTrackBar: TTrackBar;
|
ZoomTrackBar: TTrackBar;
|
||||||
procedure BtnGoToClick(Sender: TObject);
|
procedure BtnGoToClick(Sender: TObject);
|
||||||
procedure BtnLoadGPXFileClick(Sender: TObject);
|
procedure BtnLoadGPXFileClick(Sender: TObject);
|
||||||
@ -93,6 +93,7 @@ type
|
|||||||
procedure MapViewZoomChange(Sender: TObject);
|
procedure MapViewZoomChange(Sender: TObject);
|
||||||
procedure BtnLoadMapProvidersClick(Sender: TObject);
|
procedure BtnLoadMapProvidersClick(Sender: TObject);
|
||||||
procedure BtnSaveMapProvidersClick(Sender: TObject);
|
procedure BtnSaveMapProvidersClick(Sender: TObject);
|
||||||
|
procedure rgPOIModeClick(Sender: TObject);
|
||||||
procedure ZoomTrackBarChange(Sender: TObject);
|
procedure ZoomTrackBarChange(Sender: TObject);
|
||||||
|
|
||||||
private
|
private
|
||||||
@ -119,7 +120,7 @@ implementation
|
|||||||
uses
|
uses
|
||||||
LCLType, IniFiles, Math, FPCanvas, FPImage, GraphType,
|
LCLType, IniFiles, Math, FPCanvas, FPImage, GraphType,
|
||||||
mvEngine, mvGPX,
|
mvEngine, mvGPX,
|
||||||
globals, gpslistform;
|
globals, gpsPtForm, gpslistform;
|
||||||
|
|
||||||
type
|
type
|
||||||
TLocationParam = class
|
TLocationParam = class
|
||||||
@ -292,10 +293,12 @@ end;
|
|||||||
|
|
||||||
procedure TMainForm.CbShowPOIImageChange(Sender: TObject);
|
procedure TMainForm.CbShowPOIImageChange(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
|
{
|
||||||
if CbShowPOIImage.Checked then
|
if CbShowPOIImage.Checked then
|
||||||
MapView.POIImage.Assign(POIImage)
|
MapView.POIImage.Assign(POIImage)
|
||||||
else
|
else
|
||||||
MapView.POIImage.Clear;
|
MapView.POIImage.Clear;
|
||||||
|
}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainForm.CbUseThreadsChange(Sender: TObject);
|
procedure TMainForm.CbUseThreadsChange(Sender: TObject);
|
||||||
@ -379,20 +382,91 @@ end;
|
|||||||
|
|
||||||
procedure TMainForm.MapViewDrawGpsPoint(Sender: TObject;
|
procedure TMainForm.MapViewDrawGpsPoint(Sender: TObject;
|
||||||
ADrawer: TMvCustomDrawingEngine; APoint: TGpsPoint);
|
ADrawer: TMvCustomDrawingEngine; APoint: TGpsPoint);
|
||||||
const
|
|
||||||
R = 5;
|
|
||||||
var
|
var
|
||||||
P: TPoint;
|
P: TPoint;
|
||||||
|
d: Integer;
|
||||||
|
sym: TGPSSymbol;
|
||||||
|
clr: TColor;
|
||||||
|
extent: TSize;
|
||||||
begin
|
begin
|
||||||
// Screen coordinates of the GPS point
|
// Screen coordinates of the GPS point
|
||||||
P := TMapView(Sender).LonLatToScreen(APoint.RealPoint);
|
P := TMapView(Sender).LonLatToScreen(APoint.RealPoint);
|
||||||
|
|
||||||
// Draw the GPS point as a circle
|
// Draw the GPS point as specified by the data in the point's ExtraData
|
||||||
ADrawer.BrushColor := clRed;
|
if not (APoint.ExtraData is TGPSExtraData) then
|
||||||
|
exit;
|
||||||
|
|
||||||
|
// Get the POI attributes
|
||||||
|
with TGPSExtraData(APoint.ExtraData) do
|
||||||
|
begin
|
||||||
|
clr := Color;
|
||||||
|
sym := Symbol;
|
||||||
|
d := Size div 2;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// Draw the POI symbol
|
||||||
|
ADrawer.PenColor := clr;
|
||||||
|
case sym of
|
||||||
|
gpsPlus:
|
||||||
|
begin
|
||||||
|
ADrawer.Line(P.X - d, P.Y, P.X + d, P.Y);
|
||||||
|
ADrawer.Line(P.X, P.Y - d, P.X , P.Y + d);
|
||||||
|
end;
|
||||||
|
gpsCross:
|
||||||
|
begin
|
||||||
|
ADrawer.Line(P.x - d, P.Y - d, P.X + d, P.Y + d);
|
||||||
|
ADrawer.Line(P.x - d, P.Y + d, P.X + d, P.Y - d);
|
||||||
|
end;
|
||||||
|
gpsFilledCircle:
|
||||||
|
begin
|
||||||
|
ADrawer.BrushStyle := bsSolid;
|
||||||
|
ADrawer.BrushColor := clr;
|
||||||
|
ADrawer.Ellipse(P.X - d, P.Y - d, P.X + d, P.Y + d);
|
||||||
|
end;
|
||||||
|
gpsOpenCircle:
|
||||||
|
begin
|
||||||
|
ADrawer.BrushStyle := bsClear;
|
||||||
|
ADrawer.Ellipse(P.X - d, P.Y - d, P.X + d, P.Y + d);
|
||||||
|
end;
|
||||||
|
gpsFilledRect:
|
||||||
|
begin
|
||||||
|
ADrawer.BrushStyle := bsSolid;
|
||||||
|
ADrawer.BrushColor := clr;
|
||||||
|
ADrawer.Rectangle(P.X - d, P.Y - d, P.X + d, P.Y + d);
|
||||||
|
end;
|
||||||
|
gpsOpenRect:
|
||||||
|
begin
|
||||||
|
ADrawer.BrushStyle := bsClear;
|
||||||
|
ADrawer.Rectangle(P.X - d, P.Y - d, P.X + d, P.Y + d);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// Prepare text output: background color...
|
||||||
|
inc(P.Y, d + 4);
|
||||||
|
extent := ADrawer.TextExtent(APoint.Name);
|
||||||
|
if cbPOITextBgColor.selected = clNone then
|
||||||
|
ADrawer.BrushStyle := bsClear
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
ADrawer.BrushStyle := bsSolid;
|
||||||
|
ADrawer.BrushColor := cbPOITextBgColor.Selected;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// ... and font
|
||||||
|
ADrawer.FontColor := MapView.Font.Color;
|
||||||
|
ADrawer.FontName := MapView.Font.Name;
|
||||||
|
ADrawer.FontSize := MapView.Font.Size;
|
||||||
|
ADrawer.FontStyle := MapView.Font.Style;
|
||||||
|
|
||||||
|
// Write the POI text
|
||||||
|
ADrawer.TextOut(P.X - extent.CX div 2, P.Y, APoint.Name);
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ ADrawer.BrushColor := clRed;
|
||||||
ADrawer.BrushStyle := bsSolid;
|
ADrawer.BrushStyle := bsSolid;
|
||||||
ADrawer.Ellipse(P.X - R, P.Y - R, P.X + R, P.Y + R);
|
ADrawer.Ellipse(P.X - R, P.Y - R, P.X + R, P.Y + R);
|
||||||
end;
|
end;
|
||||||
|
}
|
||||||
procedure TMainForm.MapViewMouseLeave(Sender: TObject);
|
procedure TMainForm.MapViewMouseLeave(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
UpdateCoords(MaxInt, MaxInt);
|
UpdateCoords(MaxInt, MaxInt);
|
||||||
@ -440,13 +514,41 @@ var
|
|||||||
rPt: TRealPoint;
|
rPt: TRealPoint;
|
||||||
gpsPt: TGpsPoint;
|
gpsPt: TGpsPoint;
|
||||||
gpsName: String;
|
gpsName: String;
|
||||||
|
gpsSize: Integer;
|
||||||
|
gpsSymbol: TGPSSymbol;
|
||||||
|
gpsColor: TColor;
|
||||||
|
F: TGPSPointForm;
|
||||||
begin
|
begin
|
||||||
if (Button = mbRight) then begin
|
if (Button = mbRight) then begin
|
||||||
|
rPt := MapView.ScreenToLonLat(Point(X, Y));
|
||||||
|
|
||||||
|
if rgPOIMode.ItemIndex in [0, 1] then
|
||||||
|
begin
|
||||||
if not InputQuery('Name of GPS location', 'Please enter name', gpsName) then
|
if not InputQuery('Name of GPS location', 'Please enter name', gpsName) then
|
||||||
exit;
|
exit;
|
||||||
rPt := MapView.ScreenToLonLat(Point(X, Y));
|
|
||||||
gpsPt := TGpsPoint.CreateFrom(rPt);
|
gpsPt := TGpsPoint.CreateFrom(rPt);
|
||||||
gpsPt.Name := gpsName;
|
gpsPt.Name := gpsName;
|
||||||
|
end else
|
||||||
|
begin
|
||||||
|
if GPSPointForm = nil then begin
|
||||||
|
GPSPointForm := TGPSPointForm.Create(Application);
|
||||||
|
GPSPointForm.Position := poMainformCenter;
|
||||||
|
GPSPointForm.SetData('', clRed, gpsPlus, 10);
|
||||||
|
end;
|
||||||
|
if GPSPointForm.ShowModal <> mrOK then
|
||||||
|
exit;
|
||||||
|
|
||||||
|
GPSPointForm.GetData(gpsName, gpsColor, gpsSymbol, gpsSize);
|
||||||
|
gpsPt := TGpsPoint.CreateFrom(rPt);
|
||||||
|
gpsPt.Name := gpsName;
|
||||||
|
gpsPt.ExtraData := TGPSExtraData.Create(_CLICKED_POINTS_);
|
||||||
|
with TGPSExtraData(gpsPt.ExtraData) do
|
||||||
|
begin
|
||||||
|
Color := gpsColor;
|
||||||
|
Symbol := gpsSymbol;
|
||||||
|
Size := gpsSize;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
MapView.GpsItems.Add(gpsPt, _CLICKED_POINTS_);
|
MapView.GpsItems.Add(gpsPt, _CLICKED_POINTS_);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -532,6 +634,24 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.rgPOIModeClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
case rgPOIMode.ItemIndex of
|
||||||
|
0: begin // default
|
||||||
|
MapView.POIImage.Clear;
|
||||||
|
MapView.OnDrawGPSPoint := nil;
|
||||||
|
end;
|
||||||
|
1: begin
|
||||||
|
MapView.POIImage.Assign(POIImage);
|
||||||
|
MapView.OnDrawGPSPoint := nil;
|
||||||
|
end;
|
||||||
|
2: begin
|
||||||
|
MapView.POIImage.Clear;
|
||||||
|
MapView.OnDrawGPSPoint := @MapViewDrawGpsPoint;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TMainForm.UpdateCoords(X, Y: Integer);
|
procedure TMainForm.UpdateCoords(X, Y: Integer);
|
||||||
var
|
var
|
||||||
rPt: TRealPoint;
|
rPt: TRealPoint;
|
||||||
|
Reference in New Issue
Block a user