LazMapViewer: Initial version of a LCL drawing engine. Still buggy. Extend demo project to allow selection of drawing engines.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6924 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2019-05-18 17:10:33 +00:00
parent 330ea06238
commit 0418e4b8d4
5 changed files with 777 additions and 764 deletions

View File

@ -11,133 +11,103 @@ object MainForm: TMainForm
OnShow = FormShow OnShow = FormShow
ShowHint = True ShowHint = True
LCLVersion = '2.1.0.0' LCLVersion = '2.1.0.0'
object ControlPanel: TPanel object MapView: TMapView
Left = 606 Left = 0
Height = 640
Hint = 'Displays the map'
Top = 0
Width = 608
Active = False
Align = alClient
CacheOnDisk = True
CachePath = 'cache/'
DefaultTrackColor = clBlue
DefaultTrackWidth = 3
DownloadEngine = MapView.BuiltInDLE
DrawingEngine = MapView.BuiltInDE
InactiveColor = clWhite
MapProvider = 'OpenStreetMap Mapnik'
UseThreads = True
Zoom = 0
OnZoomChange = MapViewZoomChange
OnChange = MapViewChange
OnDrawGpsPoint = MapViewDrawGpsPoint
OnMouseLeave = MapViewMouseLeave
OnMouseMove = MapViewMouseMove
OnMouseUp = MapViewMouseUp
end
object PageControl: TPageControl
Left = 608
Height = 640 Height = 640
Top = 0 Top = 0
Width = 277 Width = 275
ActivePage = PgData
Align = alRight Align = alRight
ClientHeight = 640 TabIndex = 0
ClientWidth = 277
TabOrder = 1 TabOrder = 1
object CbProviders: TComboBox object PgData: TTabSheet
AnchorSideLeft.Control = LblProviders Caption = 'Data'
AnchorSideLeft.Side = asrBottom ClientHeight = 612
AnchorSideTop.Control = ControlPanel ClientWidth = 267
AnchorSideRight.Control = BtnLoadMapProviders
Left = 69
Height = 23
Top = 9
Width = 145
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 8
BorderSpacing.Top = 8
BorderSpacing.Right = 4
DropDownCount = 24
ItemHeight = 15
OnChange = CbProvidersChange
Style = csDropDownList
TabOrder = 0
end
object LblProviders: TLabel
AnchorSideLeft.Control = ControlPanel
AnchorSideTop.Control = CbProviders
AnchorSideTop.Side = asrCenter
Left = 9
Height = 15
Top = 13
Width = 52
BorderSpacing.Left = 8
Caption = 'Providers:'
FocusControl = CbProviders
ParentColor = False
end
object CbUseThreads: TCheckBox
AnchorSideLeft.Control = LblProviders
AnchorSideTop.Control = CbDoubleBuffer
Left = 9
Height = 19
Top = 40
Width = 62
Caption = 'Threads'
Checked = True
OnChange = CbUseThreadsChange
State = cbChecked
TabOrder = 1
end
object CbDoubleBuffer: TCheckBox
AnchorSideLeft.Control = CbUseThreads
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = CbProviders
AnchorSideTop.Side = asrBottom
Left = 87
Height = 19
Top = 40
Width = 87
BorderSpacing.Left = 16
BorderSpacing.Top = 8
BorderSpacing.Right = 9
Caption = 'DblBuffering'
Checked = True
OnChange = CbDoubleBufferChange
State = cbChecked
TabOrder = 2
end
object ZoomTrackBar: TTrackBar object ZoomTrackBar: TTrackBar
AnchorSideLeft.Control = CbProviders AnchorSideLeft.Control = PgData
AnchorSideTop.Control = CbDoubleBuffer AnchorSideTop.Control = LblZoom
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = ControlPanel AnchorSideRight.Control = PgData
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 69 Left = 2
Height = 40 Height = 40
Top = 59 Top = 21
Width = 207 Width = 263
Max = 19 Max = 19
Min = 1 Min = 1
OnChange = ZoomTrackBarChange OnChange = ZoomTrackBarChange
Position = 1 Position = 1
TickMarks = tmBoth TickMarks = tmBoth
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
TabOrder = 3 BorderSpacing.Left = 2
BorderSpacing.Right = 2
TabOrder = 0
end end
object LblZoom: TLabel object LblZoom: TLabel
AnchorSideLeft.Control = ControlPanel AnchorSideLeft.Control = PgData
AnchorSideTop.Control = ZoomTrackBar AnchorSideTop.Control = PgData
AnchorSideTop.Side = asrCenter Left = 6
Left = 9
Height = 15 Height = 15
Top = 72 Top = 6
Width = 35 Width = 35
BorderSpacing.Left = 8 BorderSpacing.Left = 6
BorderSpacing.Top = 6
Caption = 'Zoom:' Caption = 'Zoom:'
ParentColor = False ParentColor = False
end end
object CbMouseCoords: TGroupBox object CbMouseCoords: TGroupBox
AnchorSideLeft.Control = LblProviders AnchorSideLeft.Control = PgData
AnchorSideTop.Control = ZoomTrackBar AnchorSideTop.Control = ZoomTrackBar
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = BtnSaveMapProviders AnchorSideRight.Control = PgData
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 9 Left = 6
Height = 66 Height = 66
Top = 107 Top = 69
Width = 259 Width = 255
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
AutoSize = True AutoSize = True
BorderSpacing.Left = 6
BorderSpacing.Top = 8 BorderSpacing.Top = 8
BorderSpacing.Right = 6
Caption = 'Mouse position' Caption = 'Mouse position'
ClientHeight = 46 ClientHeight = 46
ClientWidth = 255 ClientWidth = 251
TabOrder = 4 TabOrder = 1
object LblPositionLongitude: TLabel object LblPositionLongitude: TLabel
AnchorSideLeft.Control = CbMouseCoords AnchorSideLeft.Control = CbMouseCoords
AnchorSideTop.Control = CbMouseCoords AnchorSideTop.Control = CbMouseCoords
Left = 16 Left = 8
Height = 15 Height = 15
Top = 4 Top = 4
Width = 54 Width = 54
BorderSpacing.Left = 16 BorderSpacing.Left = 8
BorderSpacing.Top = 4 BorderSpacing.Top = 4
Caption = 'Longitude' Caption = 'Longitude'
ParentColor = False ParentColor = False
@ -146,11 +116,11 @@ object MainForm: TMainForm
AnchorSideLeft.Control = CbMouseCoords AnchorSideLeft.Control = CbMouseCoords
AnchorSideTop.Control = LblPositionLongitude AnchorSideTop.Control = LblPositionLongitude
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 16 Left = 8
Height = 15 Height = 15
Top = 23 Top = 23
Width = 43 Width = 43
BorderSpacing.Left = 16 BorderSpacing.Left = 8
BorderSpacing.Top = 4 BorderSpacing.Top = 4
BorderSpacing.Bottom = 8 BorderSpacing.Bottom = 8
Caption = 'Latitude' Caption = 'Latitude'
@ -161,7 +131,7 @@ object MainForm: TMainForm
AnchorSideTop.Control = CbMouseCoords AnchorSideTop.Control = CbMouseCoords
AnchorSideRight.Control = CbMouseCoords AnchorSideRight.Control = CbMouseCoords
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 205 Left = 201
Height = 15 Height = 15
Top = 4 Top = 4
Width = 34 Width = 34
@ -178,7 +148,7 @@ object MainForm: TMainForm
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = CbMouseCoords AnchorSideRight.Control = CbMouseCoords
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 205 Left = 201
Height = 15 Height = 15
Top = 23 Top = 23
Width = 34 Width = 34
@ -192,30 +162,30 @@ object MainForm: TMainForm
end end
end end
object GbCenterCoords: TGroupBox object GbCenterCoords: TGroupBox
AnchorSideLeft.Control = LblProviders AnchorSideLeft.Control = LblZoom
AnchorSideTop.Control = CbMouseCoords AnchorSideTop.Control = CbMouseCoords
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = CbMouseCoords AnchorSideRight.Control = CbMouseCoords
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 9 Left = 6
Height = 66 Height = 66
Top = 181 Top = 143
Width = 259 Width = 255
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
AutoSize = True AutoSize = True
BorderSpacing.Top = 8 BorderSpacing.Top = 8
Caption = 'Center' Caption = 'Center'
ClientHeight = 46 ClientHeight = 46
ClientWidth = 255 ClientWidth = 251
TabOrder = 5 TabOrder = 2
object LblCenterLongitude: TLabel object LblCenterLongitude: TLabel
AnchorSideLeft.Control = GbCenterCoords AnchorSideLeft.Control = GbCenterCoords
AnchorSideTop.Control = GbCenterCoords AnchorSideTop.Control = GbCenterCoords
Left = 16 Left = 8
Height = 15 Height = 15
Top = 4 Top = 4
Width = 54 Width = 54
BorderSpacing.Left = 16 BorderSpacing.Left = 8
BorderSpacing.Top = 4 BorderSpacing.Top = 4
Caption = 'Longitude' Caption = 'Longitude'
ParentColor = False ParentColor = False
@ -224,11 +194,11 @@ object MainForm: TMainForm
AnchorSideLeft.Control = GbCenterCoords AnchorSideLeft.Control = GbCenterCoords
AnchorSideTop.Control = LblCenterLongitude AnchorSideTop.Control = LblCenterLongitude
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 16 Left = 8
Height = 15 Height = 15
Top = 23 Top = 23
Width = 43 Width = 43
BorderSpacing.Left = 16 BorderSpacing.Left = 8
BorderSpacing.Top = 4 BorderSpacing.Top = 4
BorderSpacing.Bottom = 8 BorderSpacing.Bottom = 8
Caption = 'Latitude' Caption = 'Latitude'
@ -239,7 +209,7 @@ object MainForm: TMainForm
AnchorSideTop.Control = GbCenterCoords AnchorSideTop.Control = GbCenterCoords
AnchorSideRight.Control = GbCenterCoords AnchorSideRight.Control = GbCenterCoords
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 205 Left = 201
Height = 15 Height = 15
Top = 4 Top = 4
Width = 34 Width = 34
@ -256,7 +226,7 @@ object MainForm: TMainForm
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = GbCenterCoords AnchorSideRight.Control = GbCenterCoords
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 205 Left = 201
Height = 15 Height = 15
Top = 23 Top = 23
Width = 34 Width = 34
@ -269,69 +239,166 @@ object MainForm: TMainForm
ParentColor = False ParentColor = False
end end
end end
object CbLocations: TComboBox object GbScreenSize: TGroupBox
AnchorSideLeft.Control = LblProviders AnchorSideLeft.Control = GbCenterCoords
AnchorSideTop.Control = BtnSearch AnchorSideTop.Control = GbCenterCoords
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = BtnSearch
Left = 9
Height = 23
Top = 334
Width = 190
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Right = 8
BorderSpacing.Bottom = 4
DropDownCount = 24
ItemHeight = 15
TabOrder = 6
Text = 'New York'
end
object BtnSearch: TButton
AnchorSideTop.Control = GbScreenSize
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = GbCenterCoords AnchorSideRight.Control = GbCenterCoords
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 207 Left = 6
Height = 66
Top = 217
Width = 255
Anchors = [akTop, akLeft, akRight]
AutoSize = True
BorderSpacing.Top = 8
Caption = 'Viewport size'
ClientHeight = 46
ClientWidth = 251
TabOrder = 3
object LblViewportWidth: TLabel
AnchorSideLeft.Control = GbScreenSize
AnchorSideTop.Control = GbScreenSize
Left = 8
Height = 15
Top = 4
Width = 32
BorderSpacing.Left = 8
BorderSpacing.Top = 4
Caption = 'Width'
ParentColor = False
end
object LblViewportHeight: TLabel
AnchorSideLeft.Control = GbScreenSize
AnchorSideTop.Control = LblViewportWidth
AnchorSideTop.Side = asrBottom
Left = 8
Height = 15
Top = 23
Width = 36
BorderSpacing.Left = 8
BorderSpacing.Top = 4
BorderSpacing.Bottom = 8
Caption = 'Height'
ParentColor = False
end
object InfoViewportWidth: TLabel
AnchorSideTop.Control = GbScreenSize
AnchorSideRight.Control = GbScreenSize
AnchorSideRight.Side = asrBottom
Left = 201
Height = 15
Top = 4
Width = 34
Alignment = taRightJustify
Anchors = [akTop, akRight]
BorderSpacing.Top = 4
BorderSpacing.Right = 16
Caption = 'Label2'
ParentColor = False
end
object InfoViewportHeight: TLabel
AnchorSideTop.Control = InfoViewportWidth
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = GbScreenSize
AnchorSideRight.Side = asrBottom
Left = 201
Height = 15
Top = 23
Width = 34
Alignment = taRightJustify
Anchors = [akTop, akRight]
BorderSpacing.Top = 4
BorderSpacing.Right = 16
BorderSpacing.Bottom = 8
Caption = 'Label2'
ParentColor = False
end
end
object CbDistanceUnits: TComboBox
AnchorSideTop.Control = GbCenterCoords
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = GbCenterCoords
AnchorSideRight.Side = asrBottom
Left = 189
Height = 23
Top = 215
Width = 64
Anchors = [akTop, akRight]
BorderSpacing.Top = 6
BorderSpacing.Right = 8
ItemHeight = 15
ItemIndex = 1
Items.Strings = (
'm'
'km'
'miles'
)
OnChange = CbDistanceUnitsChange
Style = csDropDownList
TabOrder = 4
Text = 'km'
end
object GbSearch: TGroupBox
AnchorSideLeft.Control = GbScreenSize
AnchorSideTop.Control = GbScreenSize
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = GbScreenSize
AnchorSideRight.Side = asrBottom
Left = 6
Height = 105
Top = 291
Width = 255
Anchors = [akTop, akLeft, akRight]
AutoSize = True
BorderSpacing.Top = 8
Caption = 'Search'
ClientHeight = 85
ClientWidth = 251
TabOrder = 5
object CbLocations: TComboBox
AnchorSideLeft.Control = GbSearch
AnchorSideTop.Control = GbSearch
AnchorSideRight.Control = BtnSearch
Left = 8
Height = 23
Top = 4
Width = 172
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 8
BorderSpacing.Top = 4
BorderSpacing.Right = 4
BorderSpacing.Bottom = 4
DropDownCount = 24
ItemHeight = 15
TabOrder = 0
Text = 'New York'
end
object BtnSearch: TButton
AnchorSideTop.Control = CbLocations
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = GbSearch
AnchorSideRight.Side = asrBottom
Left = 184
Height = 25 Height = 25
Top = 333 Top = 3
Width = 61 Width = 61
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
AutoSize = True AutoSize = True
BorderSpacing.Top = 12 BorderSpacing.Right = 6
Caption = 'Search' Caption = 'Search'
OnClick = BtnSearchClick OnClick = BtnSearchClick
TabOrder = 7 TabOrder = 1
end end
object CbFoundLocations: TComboBox object LblSelectLocation: TLabel
AnchorSideLeft.Control = LblProviders AnchorSideLeft.Control = CbLocations
AnchorSideTop.Control = Label8
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = BtnGoTo
Left = 9
Height = 21
Top = 388
Width = 196
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 4
BorderSpacing.Right = 8
DropDownCount = 24
ItemHeight = 15
ItemWidth = -2
OnDrawItem = CbFoundLocationsDrawItem
ParentShowHint = False
ShowHint = True
Style = csOwnerDrawFixed
TabOrder = 8
end
object Label8: TLabel
AnchorSideLeft.Control = LblProviders
AnchorSideTop.Control = CbLocations AnchorSideTop.Control = CbLocations
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 9 Left = 8
Height = 15 Height = 15
Top = 369 Top = 35
Width = 177 Width = 177
BorderSpacing.Top = 12 BorderSpacing.Top = 8
Caption = 'Select one of the found locations:' Caption = 'Select one of the found locations:'
ParentColor = False ParentColor = False
end end
@ -340,71 +407,218 @@ object MainForm: TMainForm
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = BtnSearch AnchorSideRight.Control = BtnSearch
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 213 Left = 190
Height = 25 Height = 25
Top = 386 Top = 52
Width = 55 Width = 55
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
AutoSize = True AutoSize = True
BorderSpacing.Bottom = 8
Caption = 'Go to' Caption = 'Go to'
OnClick = BtnGoToClick OnClick = BtnGoToClick
TabOrder = 9 TabOrder = 2
end end
object InfoBtnGPSPoints: TLabel object CbFoundLocations: TComboBox
AnchorSideLeft.Control = BtnGPSPoints AnchorSideLeft.Control = LblSelectLocation
AnchorSideTop.Control = BtnGPSPoints AnchorSideTop.Control = LblSelectLocation
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = BtnGoTo AnchorSideRight.Control = BtnGoTo
AnchorSideRight.Side = asrBottom Left = 8
Left = 9 Height = 21
Height = 52 Top = 54
Top = 483 Width = 178
Width = 259 Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 4
BorderSpacing.Right = 4
BorderSpacing.Bottom = 8
DropDownCount = 24
ItemHeight = 15
ItemWidth = -2
OnDrawItem = CbFoundLocationsDrawItem
ParentShowHint = False
ShowHint = True
Style = csOwnerDrawFixed
TabOrder = 3
end
end
object GbGPS: TGroupBox
AnchorSideLeft.Control = GbSearch
AnchorSideTop.Control = GbSearch
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = GbSearch
AnchorSideRight.Side = asrBottom
Left = 6
Height = 105
Top = 404
Width = 255
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
AutoSize = False
BorderSpacing.Top = 8 BorderSpacing.Top = 8
Caption = 'GPS points'
ClientHeight = 85
ClientWidth = 251
TabOrder = 6
object BtnGPSPoints: TButton
AnchorSideLeft.Control = GbGPS
AnchorSideTop.Control = GbGPS
AnchorSideRight.Control = GbGPS
AnchorSideRight.Side = asrBottom
Left = 192
Height = 25
Top = 0
Width = 53
Anchors = [akTop, akRight]
AutoSize = True
BorderSpacing.Left = 6
BorderSpacing.Right = 6
Caption = 'List...'
OnClick = BtnGPSPointsClick
TabOrder = 0
end
object InfoBtnGPSPoints: TLabel
AnchorSideLeft.Control = GbGPS
AnchorSideTop.Control = BtnGPSPoints
AnchorSideRight.Control = BtnGPSPoints
Left = 8
Height = 30
Top = 4
Width = 178
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 8
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.'
ParentColor = False ParentColor = False
WordWrap = True WordWrap = True
end end
object BtnGPSPoints: TButton
AnchorSideLeft.Control = LblProviders
AnchorSideTop.Control = BtnSaveToFile
AnchorSideTop.Side = asrBottom
Left = 9
Height = 25
Top = 450
Width = 92
AutoSize = True
BorderSpacing.Top = 8
Caption = 'GPS points...'
OnClick = BtnGPSPointsClick
TabOrder = 10
end
object GPSPointInfo: TLabel object GPSPointInfo: TLabel
AnchorSideLeft.Control = InfoBtnGPSPoints AnchorSideLeft.Control = InfoBtnGPSPoints
AnchorSideTop.Control = InfoBtnGPSPoints AnchorSideTop.Control = InfoBtnGPSPoints
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = InfoBtnGPSPoints AnchorSideRight.Control = GbGPS
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 9 AnchorSideBottom.Control = GbGPS
Height = 64 AnchorSideBottom.Side = asrBottom
Top = 535 Left = 8
Width = 259 Height = 35
Anchors = [akTop, akLeft, akRight] Top = 50
Width = 237
Anchors = [akTop, akLeft, akRight, akBottom]
AutoSize = False AutoSize = False
BorderSpacing.Top = 16
BorderSpacing.Right = 6
Caption = 'GPSPointInfo' Caption = 'GPSPointInfo'
ParentColor = False ParentColor = False
WordWrap = True WordWrap = True
end end
end
object BtnSaveToFile: TButton
AnchorSideLeft.Control = GbGPS
AnchorSideTop.Control = GbGPS
AnchorSideTop.Side = asrBottom
Left = 6
Height = 25
Top = 517
Width = 110
AutoSize = True
BorderSpacing.Top = 8
Caption = 'Save map to file'
OnClick = BtnSaveToFileClick
TabOrder = 7
end
object BtnLoadGPXFile: TButton
AnchorSideLeft.Control = BtnSaveToFile
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = BtnSaveToFile
Left = 124
Height = 25
Top = 517
Width = 105
AutoSize = True
BorderSpacing.Left = 8
Caption = 'Load GPX file...'
OnClick = BtnLoadGPXFileClick
TabOrder = 8
end
end
object PgConfig: TTabSheet
Caption = 'Config'
ClientHeight = 612
ClientWidth = 267
object Label1: TLabel
AnchorSideLeft.Control = CbDrawingEngine
AnchorSideTop.Control = PgConfig
Left = 6
Height = 15
Top = 6
Width = 86
BorderSpacing.Top = 6
Caption = 'Drawing engine:'
ParentColor = False
end
object CbDrawingEngine: TComboBox
AnchorSideLeft.Control = PgConfig
AnchorSideTop.Control = Label1
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = PgConfig
AnchorSideRight.Side = asrBottom
Left = 6
Height = 23
Top = 23
Width = 255
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
BorderSpacing.Top = 2
BorderSpacing.Right = 6
ItemHeight = 15
ItemIndex = 0
Items.Strings = (
'default'
'LCL'
)
OnChange = CbDrawingEngineChange
Style = csDropDownList
TabOrder = 0
Text = 'default'
end
object LblProviders: TLabel
AnchorSideLeft.Control = CbProviders
AnchorSideTop.Control = CbDrawingEngine
AnchorSideTop.Side = asrBottom
Left = 6
Height = 15
Top = 54
Width = 52
BorderSpacing.Top = 8
Caption = 'Providers:'
FocusControl = CbProviders
ParentColor = False
end
object CbProviders: TComboBox
AnchorSideLeft.Control = PgConfig
AnchorSideTop.Control = LblProviders
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = BtnLoadMapProviders
Left = 6
Height = 23
Top = 71
Width = 199
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
BorderSpacing.Top = 2
BorderSpacing.Right = 4
DropDownCount = 24
ItemHeight = 15
OnChange = CbProvidersChange
Style = csDropDownList
TabOrder = 1
end
object BtnLoadMapProviders: TSpeedButton object BtnLoadMapProviders: TSpeedButton
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = CbProviders AnchorSideTop.Control = CbProviders
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = BtnSaveMapProviders AnchorSideRight.Control = BtnSaveMapProviders
Left = 218 Left = 209
Height = 22 Height = 22
Top = 9 Top = 71
Width = 23 Width = 23
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
BorderSpacing.Right = 4 BorderSpacing.Right = 4
@ -451,11 +665,11 @@ object MainForm: TMainForm
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = CbProviders AnchorSideTop.Control = CbProviders
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = ControlPanel AnchorSideRight.Control = PgConfig
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 245 Left = 236
Height = 22 Height = 22
Top = 9 Top = 71
Width = 23 Width = 23
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
BorderSpacing.Right = 8 BorderSpacing.Right = 8
@ -497,181 +711,62 @@ object MainForm: TMainForm
} }
OnClick = BtnSaveMapProvidersClick OnClick = BtnSaveMapProvidersClick
end end
object BtnSaveToFile: TButton object CbUseThreads: TCheckBox
AnchorSideLeft.Control = LblProviders AnchorSideLeft.Control = PgConfig
AnchorSideTop.Control = CbFoundLocations AnchorSideTop.Control = CbProviders
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 9 Left = 6
Height = 25 Height = 19
Top = 417 Top = 102
Width = 110 Width = 81
AutoSize = True BorderSpacing.Left = 6
BorderSpacing.Top = 8 BorderSpacing.Top = 8
Caption = 'Save map to file' Caption = 'Use threads'
OnClick = BtnSaveToFileClick Checked = True
TabOrder = 11 OnChange = CbUseThreadsChange
State = cbChecked
TabOrder = 2
end end
object GbScreenSize: TGroupBox object CbDoubleBuffer: TCheckBox
AnchorSideLeft.Control = GbCenterCoords AnchorSideLeft.Control = CbUseThreads
AnchorSideTop.Control = GbCenterCoords AnchorSideTop.Control = CbUseThreads
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = GbCenterCoords Left = 6
AnchorSideRight.Side = asrBottom Height = 19
Left = 9 Top = 127
Height = 66 Width = 87
Top = 255
Width = 259
Anchors = [akTop, akLeft, akRight]
AutoSize = True
BorderSpacing.Top = 8
Caption = 'Viewport size'
ClientHeight = 46
ClientWidth = 255
TabOrder = 12
object LblViewportWidth: TLabel
AnchorSideLeft.Control = GbScreenSize
AnchorSideTop.Control = GbScreenSize
Left = 16
Height = 15
Top = 4
Width = 32
BorderSpacing.Left = 16
BorderSpacing.Top = 4
Caption = 'Width'
ParentColor = False
end
object LblViewportHeight: TLabel
AnchorSideLeft.Control = GbScreenSize
AnchorSideTop.Control = LblViewportWidth
AnchorSideTop.Side = asrBottom
Left = 16
Height = 15
Top = 23
Width = 36
BorderSpacing.Left = 16
BorderSpacing.Top = 4
BorderSpacing.Bottom = 8
Caption = 'Height'
ParentColor = False
end
object InfoViewportWidth: TLabel
AnchorSideTop.Control = GbScreenSize
AnchorSideRight.Control = GbScreenSize
AnchorSideRight.Side = asrBottom
Left = 205
Height = 15
Top = 4
Width = 34
Alignment = taRightJustify
Anchors = [akTop, akRight]
BorderSpacing.Top = 4
BorderSpacing.Right = 16
Caption = 'Label2'
ParentColor = False
end
object InfoViewportHeight: TLabel
AnchorSideTop.Control = InfoViewportWidth
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = GbScreenSize
AnchorSideRight.Side = asrBottom
Left = 205
Height = 15
Top = 23
Width = 34
Alignment = taRightJustify
Anchors = [akTop, akRight]
BorderSpacing.Top = 4
BorderSpacing.Right = 16
BorderSpacing.Bottom = 8
Caption = 'Label2'
ParentColor = False
end
end
object CbDistanceUnits: TComboBox
AnchorSideTop.Control = GbCenterCoords
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = GbCenterCoords
AnchorSideRight.Side = asrBottom
Left = 176
Height = 23
Top = 253
Width = 76
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 6 BorderSpacing.Top = 6
BorderSpacing.Right = 16 BorderSpacing.Right = 9
ItemHeight = 15 Caption = 'DblBuffering'
ItemIndex = 1 Checked = True
Items.Strings = ( OnChange = CbDoubleBufferChange
'm' State = cbChecked
'km' TabOrder = 3
'miles'
)
OnChange = CbDistanceUnitsChange
Style = csDropDownList
TabOrder = 13
Text = 'km'
end
object BtnLoadGPXFile: TButton
AnchorSideLeft.Control = BtnSaveToFile
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = BtnSaveToFile
Left = 127
Height = 25
Top = 417
Width = 105
AutoSize = True
BorderSpacing.Left = 8
Caption = 'Load GPX file...'
OnClick = BtnLoadGPXFileClick
TabOrder = 14
end end
object CbDebugTiles: TCheckBox object CbDebugTiles: TCheckBox
AnchorSideLeft.Control = CbDoubleBuffer AnchorSideLeft.Control = CbDoubleBuffer
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = CbDoubleBuffer AnchorSideTop.Control = CbDoubleBuffer
Left = 190 AnchorSideTop.Side = asrBottom
Left = 6
Height = 19 Height = 19
Top = 40 Top = 152
Width = 55 Width = 79
BorderSpacing.Left = 16 BorderSpacing.Top = 6
Caption = 'Debug' Caption = 'Debug tiles'
OnChange = CbDebugTilesChange OnChange = CbDebugTilesChange
TabOrder = 15 TabOrder = 4
end end
end end
object MapView: TMapView
Left = 0
Height = 640
Hint = 'Displays the map'
Top = 0
Width = 606
Active = False
Align = alClient
CacheOnDisk = True
CachePath = 'cache/'
DefaultTrackColor = clBlue
DefaultTrackWidth = 3
DownloadEngine = MapView.BuiltIn
InactiveColor = clWhite
MapProvider = 'OpenStreetMap Mapnik'
UseThreads = True
Zoom = 0
OnZoomChange = MapViewZoomChange
OnChange = MapViewChange
OnDrawGpsPoint = MapViewDrawGpsPoint
OnMouseLeave = MapViewMouseLeave
OnMouseMove = MapViewMouseMove
OnMouseUp = MapViewMouseUp
end end
object GeoNames: TMVGeoNames object GeoNames: TMVGeoNames
OnNameFound = GeoNamesNameFound OnNameFound = GeoNamesNameFound
left = 328 left = 240
top = 224 top = 192
end end
object OpenDialog: TOpenDialog object OpenDialog: TOpenDialog
DefaultExt = '.pgx' DefaultExt = '.pgx'
Filter = 'GPX files (*.gpx)|*.gpx|All files (*.*)|*.*' Filter = 'GPX files (*.gpx)|*.gpx|All files (*.*)|*.*'
left = 832 left = 240
top = 424 top = 456
end end
end end

View File

@ -7,7 +7,7 @@ interface
uses uses
Classes, SysUtils, Types, Forms, Controls, Graphics, Dialogs, Classes, SysUtils, Types, Forms, Controls, Graphics, Dialogs,
ExtCtrls, StdCtrls, ComCtrls, Buttons, ExtCtrls, StdCtrls, ComCtrls, Buttons,
mvGeoNames, mvMapViewer, mvTypes, mvGpsObj, mvDrawingEngine; mvGeoNames, mvMapViewer, mvTypes, mvGpsObj, mvDrawingEngine, mvDE_LCL;
type type
@ -27,15 +27,19 @@ type
CbMouseCoords: TGroupBox; CbMouseCoords: TGroupBox;
CbDistanceUnits: TComboBox; CbDistanceUnits: TComboBox;
CbDebugTiles: TCheckBox; CbDebugTiles: TCheckBox;
CbDrawingEngine: TComboBox;
GbCenterCoords: TGroupBox; GbCenterCoords: TGroupBox;
GbScreenSize: TGroupBox; GbScreenSize: TGroupBox;
GbSearch: TGroupBox;
GbGPS: TGroupBox;
InfoCenterLatitude: TLabel; InfoCenterLatitude: TLabel;
InfoViewportHeight: TLabel; InfoViewportHeight: TLabel;
InfoCenterLongitude: TLabel; InfoCenterLongitude: TLabel;
InfoBtnGPSPoints: TLabel; InfoBtnGPSPoints: TLabel;
GPSPointInfo: TLabel; GPSPointInfo: TLabel;
InfoViewportWidth: TLabel; InfoViewportWidth: TLabel;
Label8: TLabel; Label1: TLabel;
LblSelectLocation: TLabel;
LblCenterLatitude: TLabel; LblCenterLatitude: TLabel;
LblViewportHeight: TLabel; LblViewportHeight: TLabel;
LblViewportWidth: TLabel; LblViewportWidth: TLabel;
@ -48,10 +52,12 @@ type
LblZoom: TLabel; LblZoom: TLabel;
MapView: TMapView; MapView: TMapView;
GeoNames: TMVGeoNames; GeoNames: TMVGeoNames;
ControlPanel: TPanel;
BtnLoadMapProviders: TSpeedButton; BtnLoadMapProviders: TSpeedButton;
BtnSaveMapProviders: TSpeedButton; BtnSaveMapProviders: TSpeedButton;
OpenDialog: TOpenDialog; OpenDialog: TOpenDialog;
PageControl: TPageControl;
PgData: TTabSheet;
PgConfig: TTabSheet;
ZoomTrackBar: TTrackBar; ZoomTrackBar: TTrackBar;
procedure BtnGoToClick(Sender: TObject); procedure BtnGoToClick(Sender: TObject);
procedure BtnLoadGPXFileClick(Sender: TObject); procedure BtnLoadGPXFileClick(Sender: TObject);
@ -59,6 +65,7 @@ type
procedure BtnGPSPointsClick(Sender: TObject); procedure BtnGPSPointsClick(Sender: TObject);
procedure BtnSaveToFileClick(Sender: TObject); procedure BtnSaveToFileClick(Sender: TObject);
procedure CbDebugTilesChange(Sender: TObject); procedure CbDebugTilesChange(Sender: TObject);
procedure CbDrawingEngineChange(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);
@ -84,6 +91,7 @@ type
procedure ZoomTrackBarChange(Sender: TObject); procedure ZoomTrackBarChange(Sender: TObject);
private private
FLCLDrawingEngine: TLCLDrawingEngine;
procedure ClearFoundLocations; procedure ClearFoundLocations;
procedure UpdateCoords(X, Y: Integer); procedure UpdateCoords(X, Y: Integer);
procedure UpdateDropdownWidth(ACombobox: TCombobox); procedure UpdateDropdownWidth(ACombobox: TCombobox);
@ -105,7 +113,7 @@ implementation
uses uses
LCLType, IniFiles, Math, FPCanvas, FPImage, IntfGraphics, LCLType, IniFiles, Math, FPCanvas, FPImage, IntfGraphics,
mvEngine, mvExtraData, mvGPX, mvEngine, mvGPX,
globals, gpslistform; globals, gpslistform;
type type
@ -226,6 +234,17 @@ begin
MapView.DebugTiles := CbDebugTiles.Checked; MapView.DebugTiles := CbDebugTiles.Checked;
end; end;
procedure TMainForm.CbDrawingEngineChange(Sender: TObject);
begin
case CbDrawingEngine.ItemIndex of
0: MapView.DrawingEngine := nil;
1: begin
if FLCLDrawingEngine = nil then FLCLDrawingEngine := TLCLDrawingEngine.Create(self);
MapView.DrawingEngine := FLCLDrawingEngine;
end;
end;
end;
procedure TMainForm.CbDoubleBufferChange(Sender: TObject); procedure TMainForm.CbDoubleBufferChange(Sender: TObject);
begin begin
MapView.DoubleBuffered := CbDoubleBuffer.Checked; MapView.DoubleBuffered := CbDoubleBuffer.Checked;
@ -296,10 +315,17 @@ begin
CbProviders.ItemIndex := CbProviders.Items.Indexof(MapView.MapProvider); CbProviders.ItemIndex := CbProviders.Items.Indexof(MapView.MapProvider);
MapView.DoubleBuffered := true; MapView.DoubleBuffered := true;
MapView.Zoom := 1; MapView.Zoom := 1;
ControlPanel.Caption := '';
CbUseThreads.Checked := MapView.UseThreads; CbUseThreads.Checked := MapView.UseThreads;
CbDoubleBuffer.Checked := MapView.DoubleBuffered; CbDoubleBuffer.Checked := MapView.DoubleBuffered;
InfoPositionLongitude.Caption := '';
InfoPositionLatitude.Caption := '';
InfoCenterLongitude.Caption := '';
InfoCenterLatitude.Caption := '';
InfoViewportWidth.Caption := '';
InfoViewportHeight.Caption := '';
GPSPointInfo.caption := '';
ReadFromIni; ReadFromIni;
end; end;
@ -343,6 +369,7 @@ begin
// Draw the GPS point as a circle // Draw the GPS point as a circle
ADrawer.BrushColor := clRed; ADrawer.BrushColor := clRed;
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);
// Draw the caption of the GPS point // Draw the caption of the GPS point

View File

@ -14,7 +14,7 @@
<Description Value="Component for viewing maps (Google, OpenStreetMap, etc). <Description Value="Component for viewing maps (Google, OpenStreetMap, etc).
This is a fork of MapViewer by ti_dic (https://sourceforge.net/p/roadbook/code/ci/master/tree/mapviewer/) which itself is based on the MapViewer by Maciej Kaczkowski (https://github.com/maciejkaczkowski/mapviewer)."/> This is a fork of MapViewer by ti_dic (https://sourceforge.net/p/roadbook/code/ci/master/tree/mapviewer/) which itself is based on the MapViewer by Maciej Kaczkowski (https://github.com/maciejkaczkowski/mapviewer)."/>
<License Value="GPL2 or later"/> <License Value="GPL2 or later"/>
<Files Count="17"> <Files Count="18">
<Item1> <Item1>
<Filename Value="source/mvcache.pas"/> <Filename Value="source/mvcache.pas"/>
<UnitName Value="mvCache"/> <UnitName Value="mvCache"/>
@ -74,16 +74,20 @@ This is a fork of MapViewer by ti_dic (https://sourceforge.net/p/roadbook/code/c
</Item14> </Item14>
<Item15> <Item15>
<Filename Value="source/mvgpx.pas"/> <Filename Value="source/mvgpx.pas"/>
<UnitName Value="mvgpx"/> <UnitName Value="mvGPX"/>
</Item15> </Item15>
<Item16> <Item16>
<Filename Value="source/mvdrawingengine.pas"/> <Filename Value="source/mvdrawingengine.pas"/>
<UnitName Value="mvdrawingengine"/> <UnitName Value="mvDrawingEngine"/>
</Item16> </Item16>
<Item17> <Item17>
<Filename Value="source/mvdeintfgraphics.pas"/> <Filename Value="source/mvde_intfgraphics.pas"/>
<UnitName Value="mvdeintfgraphics"/> <UnitName Value="mvde_intfgraphics"/>
</Item17> </Item17>
<Item18>
<Filename Value="source/mvde_lcl.pas"/>
<UnitName Value="mvde_lcl"/>
</Item18>
</Files> </Files>
<RequiredPkgs Count="1"> <RequiredPkgs Count="1">
<Item1> <Item1>

View File

@ -10,8 +10,8 @@ interface
uses uses
mvCache, mvDownloadEngine, mvDragObj, mvEngine, mvGeoNames, mvGpsObj, mvCache, mvDownloadEngine, mvDragObj, mvEngine, mvGeoNames, mvGpsObj,
mvJobQueue, mvJobs, mvMapProvider, mvTypes, mvMapViewer, mvExtraData, mvJobQueue, mvJobs, mvMapProvider, mvTypes, mvMapViewer, mvExtraData,
mvDLEFpc, mvMapViewerReg, mvGPX, mvDrawingEngine, mvDEIntfGraphics, mvDLEFpc, mvMapViewerReg, mvGPX, mvDrawingEngine, mvDE_IntfGraphics,
LazarusPackageIntf; mvDE_LCL, LazarusPackageIntf;
implementation implementation

View File

@ -20,21 +20,11 @@
unit mvMapViewer; unit mvMapViewer;
{$MODE objfpc}{$H+} {$MODE objfpc}{$H+}
(*
// Activate one of the following defines
{$DEFINE USE_LAZINTFIMAGE}
{.$DEFINE USE_RGBGRAPHICS} // NOTE: This needs package "rgb_graphics" in requirements
// Make sure that one of the USE_XXXX defines is active. Default is USE_LAZINTFIMAGE
{$IFNDEF USE_RGBGRAPHICS}{$IFNDEF USE_LAZINTFIMAGE}{$DEFINE USE_LAZINTFIMAGES}{$ENDIF}{$ENDIF}
{$IFDEF USE_RGBGRAPHICS}{$IFDEF USE_LAZINTFIMAGE}{$UNDEF USE_RGBGRAPHICS}{$ENDIF}{$ENDIF}
*)
interface interface
uses uses
Classes, SysUtils, Controls, Graphics, IntfGraphics, Classes, SysUtils, Controls, Graphics, IntfGraphics,
// {$IFDEF USE_RGBGRAPHICS}RGBGraphics,{$ENDIF}
// {$IFDEF USE_LAZINTFIMAGE}FPCanvas,{$ENDIF}
MvTypes, MvGPSObj, MvEngine, MvMapProvider, MvDownloadEngine, MvDrawingEngine; MvTypes, MvGPSObj, MvEngine, MvMapProvider, MvDownloadEngine, MvDrawingEngine;
Type Type
@ -104,12 +94,6 @@ Type
protected protected
AsyncInvalidate : boolean; AsyncInvalidate : boolean;
procedure ActivateEngine; procedure ActivateEngine;
(*
{$IFDEF USE_LAZINTFIMAGE}
procedure CreateLazIntfImageAndCanvas(out ABuffer: TLazIntfImage;
out ACanvas: TFPCustomCanvas; AWidth, AHeight: Integer);
{$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); procedure DoDrawTileInfo(const TileID: TTileID; X,Y: Integer);
@ -176,65 +160,7 @@ Type
implementation implementation
uses uses
{$IFDEF USE_LAZINTFIMAGE} GraphType, mvJobQueue, mvExtraData, mvDLEFpc, mvDE_IntfGraphics;
Math, FPImgCanv, FPImage, LCLVersion,
{$ENDIF}
GraphType, mvJobQueue, mvExtraData, mvDLEFpc, mvDEIntfGraphics;
(*
{$IFDEF USE_LAZINTFIMAGE}
// Workaround for http://mantis.freepascal.org/view.php?id=27144
procedure CopyPixels(ASource, ADest: TLazIntfImage;
XDst: Integer = 0; YDst: Integer = 0;
AlphaMask: Boolean = False; AlphaTreshold: Word = 0);
var
SrcHasMask, DstHasMask: Boolean;
x, y, xStart, yStart, xStop, yStop: Integer;
c: TFPColor;
SrcRawImage, DestRawImage: TRawImage;
begin
ASource.GetRawImage(SrcRawImage);
ADest.GetRawImage(DestRawImage);
if DestRawImage.Description.IsEqual(SrcRawImage.Description) and (XDst = 0) and (YDst = 0) then
begin
// same description -> copy
if DestRawImage.Data <> nil then
System.Move(SrcRawImage.Data^, DestRawImage.Data^, DestRawImage.DataSize);
if DestRawImage.Mask <> nil then
System.Move(SrcRawImage.Mask^, DestRawImage.Mask^, DestRawImage.MaskSize);
Exit;
end;
// copy pixels
XStart := IfThen(XDst < 0, -XDst, 0);
YStart := IfThen(YDst < 0, -YDst, 0);
XStop := IfThen(ADest.Width - XDst < ASource.Width, ADest.Width - XDst, ASource.Width) - 1;
YStop := IfTHen(ADest.Height - YDst < ASource.Height, ADest.Height - YDst, ASource.Height) - 1;
SrcHasMask := SrcRawImage.Description.MaskBitsPerPixel > 0;
DstHasMask := DestRawImage.Description.MaskBitsPerPixel > 0;
if DstHasMask then begin
for y:= yStart to yStop do
for x:=xStart to xStop do
ADest.Masked[x+XDst,y+YDst] := SrcHasMask and ASource.Masked[x,y];
end;
for y:=yStart to yStop do
for x:=xStart to xStop do
begin
c := ASource.Colors[x,y];
if not DstHasMask and SrcHasMask and (c.alpha = $FFFF) then // copy mask to alpha channel
if ASource.Masked[x,y] then
c.alpha := 0;
ADest.Colors[x+XDst,y+YDst] := c;
if AlphaMask and (c.alpha < AlphaTreshold) then
ADest.Masked[x+XDst,y+YDst] := True;
end;
end;
{$ENDIF} *)
Type Type
@ -462,6 +388,7 @@ begin
FBuiltinDrawingEngine.CreateBuffer(0, 0); FBuiltinDrawingEngine.CreateBuffer(0, 0);
FDrawingEngine.CreateBuffer(ClientWidth, ClientHeight); FDrawingEngine.CreateBuffer(ClientWidth, ClientHeight);
end; end;
Engine.Redraw;
end; end;
procedure TMapView.SetInactiveColor(AValue: TColor); procedure TMapView.SetInactiveColor(AValue: TColor);
@ -822,6 +749,7 @@ begin
end end
else begin else begin
DrawingEngine.BrushColor := clWhite; DrawingEngine.BrushColor := clWhite;
DrawingEngine.BrushStyle := bsSolid;
DrawingEngine.FillRect(X, Y, X + TILE_SIZE, Y + TILE_SIZE); DrawingEngine.FillRect(X, Y, X + TILE_SIZE, Y + TILE_SIZE);
(* (*
{$IFDEF USE_RGBGRAPHICS} {$IFDEF USE_RGBGRAPHICS}
@ -849,28 +777,6 @@ begin
DrawingEngine.Line(X, Y, X + TILE_SIZE, Y); DrawingEngine.Line(X, Y, X + TILE_SIZE, Y);
DrawingEngine.Line(X + TILE_SIZE, Y, X + TILE_SIZE, Y + TILE_SIZE); DrawingEngine.Line(X + TILE_SIZE, Y, X + TILE_SIZE, Y + TILE_SIZE);
DrawingEngine.Line(X, Y + TILE_SIZE, X + TILE_SIZE, Y + TILE_SIZE); DrawingEngine.Line(X, Y + TILE_SIZE, X + TILE_SIZE, Y + TILE_SIZE);
(*
{$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; end;
function TMapView.IsActive: Boolean; function TMapView.IsActive: Boolean;
@ -889,7 +795,7 @@ begin
FInactiveColor := clWhite; FInactiveColor := clWhite;
FEngine := TMapViewerEngine.Create(self); FEngine := TMapViewerEngine.Create(self);
FBuiltinDownloadEngine := TMvDEFpc.Create(self); FBuiltinDownloadEngine := TMvDEFpc.Create(self);
FBuiltinDownLoadEngine.Name := 'BuiltIn'; FBuiltinDownloadEngine.Name := 'BuiltInDLE';
FDefaultTrackColor := clRed; FDefaultTrackColor := clRed;
FDefaultTrackWidth := 1; FDefaultTrackWidth := 1;
(* (*
@ -909,6 +815,7 @@ begin
Width := 150; Width := 150;
Height := 150; Height := 150;
FBuiltinDrawingEngine := TIntfGraphicsDrawingEngine.Create(self); FBuiltinDrawingEngine := TIntfGraphicsDrawingEngine.Create(self);
FBuiltinDrawingEngine.Name := 'BuiltInDE';
FbuiltinDrawingEngine.CreateBuffer(Width, Height); FbuiltinDrawingEngine.CreateBuffer(Width, Height);
end; end;
@ -924,26 +831,6 @@ begin
FreeAndNil(FGPSItems); FreeAndNil(FGPSItems);
inherited Destroy; inherited Destroy;
end; end;
(*
{$IFDEF USE_LAZINTFIMAGE}
procedure TMapView.CreateLazIntfImageAndCanvas(out ABuffer: TLazIntfImage;
out ACanvas: TFPCustomCanvas; AWidth, AHeight: Integer);
var
rawImg: TRawImage;
begin
rawImg.Init;
{$IFDEF DARWIN}
rawImg.Description.Init_BPP32_A8R8G8B8_BIO_TTB(AWidth, AHeight);
{$ELSE}
rawImg.Description.Init_BPP32_B8G8R8_BIO_TTB(AWidth, AHeight);
{$ENDIF}
rawImg.CreateData(True);
ABuffer := TLazIntfImage.Create(rawImg, true);
ACanvas := TFPImageCanvas.Create(ABuffer);
ACanvas.Brush.FPColor := colWhite;
ACanvas.FillRect(0, 0, AWidth, AHeight);
end;
{$ENDIF} *)
procedure TMapView.SaveToFile(AClass: TRasterImageClass; const AFileName: String); procedure TMapView.SaveToFile(AClass: TRasterImageClass; const AFileName: String);
var var