Merge remote-tracking branch 'origin/djes' into djes
# Conflicts: # PBMap.pb
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
PBMap.pb.bak
|
205
PBMap.pb
205
PBMap.pb
@@ -2,18 +2,14 @@
|
|||||||
; Program: PBMap
|
; Program: PBMap
|
||||||
; Description: Permits the use of tiled maps like
|
; Description: Permits the use of tiled maps like
|
||||||
; OpenStreetMap in a handy PureBASIC module
|
; OpenStreetMap in a handy PureBASIC module
|
||||||
; Author: Thyphoon, Djes And Idle
|
; Author: Thyphoon, djes And Idle
|
||||||
; Date: Mai 17, 2016
|
; Date: Mai 17, 2016
|
||||||
; License: Free, unrestricted, credit appreciated
|
; License: Free, unrestricted, credit appreciated
|
||||||
; but not required.
|
; but not required.
|
||||||
; Note: Please share improvement !
|
; Note: Please share improvement !
|
||||||
; Thanks: Progi1984
|
; Thanks: Progi1984
|
||||||
; Usage: Change the Proxy global variables if needed
|
|
||||||
; (see also Proxy Details)
|
|
||||||
;**************************************************************
|
;**************************************************************
|
||||||
|
|
||||||
;#Red = 255
|
|
||||||
|
|
||||||
CompilerIf #PB_Compiler_Thread = #False
|
CompilerIf #PB_Compiler_Thread = #False
|
||||||
MessageRequester("Warning !!","You must enable ThreadSafe support in compiler options",#PB_MessageRequester_Ok )
|
MessageRequester("Warning !!","You must enable ThreadSafe support in compiler options",#PB_MessageRequester_Ok )
|
||||||
End
|
End
|
||||||
@@ -113,8 +109,6 @@ Module PBMap
|
|||||||
TileCoordinates.Coordinates
|
TileCoordinates.Coordinates
|
||||||
Bounds.TileBounds
|
Bounds.TileBounds
|
||||||
Canvas.i
|
Canvas.i
|
||||||
;PBMapTileX.i
|
|
||||||
;PBMapTileY.i
|
|
||||||
PBMapZoom.i
|
PBMapZoom.i
|
||||||
GeographicCoordinates.GeographicCoordinates
|
GeographicCoordinates.GeographicCoordinates
|
||||||
CenterX.i
|
CenterX.i
|
||||||
@@ -149,6 +143,7 @@ Module PBMap
|
|||||||
CallBackPointer.i ; @Procedure(X.i, Y.i) to DrawPointer (you must use VectorDrawing lib)
|
CallBackPointer.i ; @Procedure(X.i, Y.i) to DrawPointer (you must use VectorDrawing lib)
|
||||||
EndStructure
|
EndStructure
|
||||||
|
|
||||||
|
;-Options
|
||||||
Structure Option
|
Structure Option
|
||||||
HDDCachePath.s ; Path where to load and save tiles downloaded from server
|
HDDCachePath.s ; Path where to load and save tiles downloaded from server
|
||||||
DefaultOSMServer.s ; Base layer OSM server
|
DefaultOSMServer.s ; Base layer OSM server
|
||||||
@@ -163,13 +158,15 @@ Module PBMap
|
|||||||
ShowDebugInfos.i
|
ShowDebugInfos.i
|
||||||
ShowScale.i
|
ShowScale.i
|
||||||
ShowTrack.i
|
ShowTrack.i
|
||||||
|
ShowTrackKms.i
|
||||||
ShowMarkers.i
|
ShowMarkers.i
|
||||||
ShowPointer.i
|
ShowPointer.i
|
||||||
TimerInterval.i
|
TimerInterval.i
|
||||||
MaxMemCache.i ; in MiB
|
MaxMemCache.i ; in MiB
|
||||||
TrackShowKms.i
|
|
||||||
ShowMarkersNb.i
|
ShowMarkersNb.i
|
||||||
ShowMarkersLegend.i
|
ShowMarkersLegend.i
|
||||||
|
;Colours
|
||||||
|
ColourFocus.i
|
||||||
EndStructure
|
EndStructure
|
||||||
|
|
||||||
Structure Layer
|
Structure Layer
|
||||||
@@ -355,6 +352,27 @@ Module PBMap
|
|||||||
EndSelect
|
EndSelect
|
||||||
EndMacro
|
EndMacro
|
||||||
|
|
||||||
|
Procedure.i ColourString2Value(Value.s)
|
||||||
|
;TODO : better string check
|
||||||
|
Protected Col.s = RemoveString(Value, " ")
|
||||||
|
If Left(Col, 1) = "$"
|
||||||
|
Protected r.i, g.i, b.i, a.i = 255
|
||||||
|
Select Len(Col)
|
||||||
|
Case 4 ;RGB (eg : "$9BC"
|
||||||
|
r = Val("$"+Mid(Col, 2, 1)) : g = Val("$"+Mid(Col, 3, 1)) : b = Val("$"+Mid(Col, 4, 1))
|
||||||
|
Case 5 ;RGBA (eg : "$9BC5")
|
||||||
|
r = Val("$"+Mid(Col, 2, 1)) : g = Val("$"+Mid(Col, 3, 1)) : b = Val("$"+Mid(Col, 4, 1)) : a = Val("$"+Mid(Col, 5, 1))
|
||||||
|
Case 7 ;RRGGBB (eg : "$95B4C2")
|
||||||
|
r = Val("$"+Mid(Col, 2, 2)) : g = Val("$"+Mid(Col, 4, 2)) : b = Val("$"+Mid(Col, 6, 2))
|
||||||
|
Case 9 ;RRGGBBAA (eg : "$95B4C249")
|
||||||
|
r = Val("$"+Mid(Col, 2, 2)) : g = Val("$"+Mid(Col, 4, 2)) : b = Val("$"+Mid(Col, 6, 2)) : a = Val("$"+Mid(Col, 8, 2))
|
||||||
|
EndSelect
|
||||||
|
ProcedureReturn RGBA(r, g, b, a)
|
||||||
|
Else
|
||||||
|
ProcedureReturn Val(Value)
|
||||||
|
EndIf
|
||||||
|
EndProcedure
|
||||||
|
|
||||||
Procedure SetOption(Option.s, Value.s)
|
Procedure SetOption(Option.s, Value.s)
|
||||||
Option = StringCheck(Option)
|
Option = StringCheck(Option)
|
||||||
Select LCase(Option)
|
Select LCase(Option)
|
||||||
@@ -388,8 +406,10 @@ Module PBMap
|
|||||||
SelBool(ShowMarkersNb)
|
SelBool(ShowMarkersNb)
|
||||||
Case "showmarkerslegend"
|
Case "showmarkerslegend"
|
||||||
SelBool(ShowMarkersLegend)
|
SelBool(ShowMarkersLegend)
|
||||||
Case "trackshowkms"
|
Case "showtrackkms"
|
||||||
SelBool(TrackShowKms)
|
SelBool(ShowTrackKms)
|
||||||
|
Case "colourfocus"
|
||||||
|
PBMap\Options\ColourFocus = ColourString2Value(Value)
|
||||||
EndSelect
|
EndSelect
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
@@ -400,28 +420,32 @@ Module PBMap
|
|||||||
Else
|
Else
|
||||||
CreatePreferences(PreferencesFile)
|
CreatePreferences(PreferencesFile)
|
||||||
EndIf
|
EndIf
|
||||||
|
With PBMap\Options
|
||||||
PreferenceGroup("PROXY")
|
PreferenceGroup("PROXY")
|
||||||
WritePreferenceInteger("Proxy", PBMap\Options\Proxy)
|
WritePreferenceInteger("Proxy", \Proxy)
|
||||||
WritePreferenceString("ProxyURL", PBMap\Options\ProxyURL)
|
WritePreferenceString("ProxyURL", \ProxyURL)
|
||||||
WritePreferenceString("ProxyPort", PBMap\Options\ProxyPort)
|
WritePreferenceString("ProxyPort", \ProxyPort)
|
||||||
WritePreferenceString("ProxyUser", PBMap\Options\ProxyUser)
|
WritePreferenceString("ProxyUser", \ProxyUser)
|
||||||
PreferenceGroup("URL")
|
PreferenceGroup("URL")
|
||||||
WritePreferenceString("DefaultOSMServer", PBMap\Options\DefaultOSMServer)
|
WritePreferenceString("DefaultOSMServer", \DefaultOSMServer)
|
||||||
PreferenceGroup("PATHS")
|
PreferenceGroup("PATHS")
|
||||||
WritePreferenceString("TilesCachePath", PBMap\Options\HDDCachePath)
|
WritePreferenceString("TilesCachePath", \HDDCachePath)
|
||||||
PreferenceGroup("OPTIONS")
|
PreferenceGroup("OPTIONS")
|
||||||
WritePreferenceInteger("WheelMouseRelative", PBMap\Options\WheelMouseRelative)
|
WritePreferenceInteger("WheelMouseRelative", \WheelMouseRelative)
|
||||||
WritePreferenceInteger("MaxMemCache", PBMap\Options\MaxMemCache)
|
WritePreferenceInteger("MaxMemCache", \MaxMemCache)
|
||||||
WritePreferenceInteger("ShowDegrees", PBMap\Options\ShowDegrees)
|
WritePreferenceInteger("ShowDegrees", \ShowDegrees)
|
||||||
WritePreferenceInteger("ShowDebugInfos", PBMap\Options\ShowDebugInfos)
|
WritePreferenceInteger("ShowDebugInfos", \ShowDebugInfos)
|
||||||
WritePreferenceInteger("ShowScale", PBMap\Options\ShowScale)
|
WritePreferenceInteger("ShowScale", \ShowScale)
|
||||||
WritePreferenceInteger("ShowMarkers", PBMap\Options\ShowMarkers)
|
WritePreferenceInteger("ShowMarkers", \ShowMarkers)
|
||||||
WritePreferenceInteger("ShowPointer", PBMap\Options\ShowPointer)
|
WritePreferenceInteger("ShowPointer", \ShowPointer)
|
||||||
WritePreferenceInteger("ShowTrack", PBMap\Options\ShowTrack)
|
WritePreferenceInteger("ShowTrack", \ShowTrack)
|
||||||
WritePreferenceInteger("ShowMarkersNb", PBMap\Options\ShowMarkersNb)
|
WritePreferenceInteger("ShowTrackKms", \ShowTrackKms)
|
||||||
WritePreferenceInteger("ShowMarkersLegend", PBMap\Options\ShowMarkersLegend)
|
WritePreferenceInteger("ShowMarkersNb", \ShowMarkersNb)
|
||||||
WritePreferenceInteger("TrackShowKms", PBMap\Options\TrackShowKms)
|
WritePreferenceInteger("ShowMarkersLegend", \ShowMarkersLegend)
|
||||||
|
;Colours;
|
||||||
|
WritePreferenceInteger("ColourFocus", \ColourFocus)
|
||||||
ClosePreferences()
|
ClosePreferences()
|
||||||
|
EndWith
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
Procedure LoadOptions(PreferencesFile.s = "PBMap.prefs")
|
Procedure LoadOptions(PreferencesFile.s = "PBMap.prefs")
|
||||||
@@ -443,33 +467,37 @@ Module PBMap
|
|||||||
; WritePreferenceString("ProxyUser", "myproxyname")
|
; WritePreferenceString("ProxyUser", "myproxyname")
|
||||||
; WritePreferenceString("ProxyPass", "myproxypass") ;TODO !Warning! !not encoded!
|
; WritePreferenceString("ProxyPass", "myproxypass") ;TODO !Warning! !not encoded!
|
||||||
; ClosePreferences()
|
; ClosePreferences()
|
||||||
|
With PBMap\Options
|
||||||
PreferenceGroup("PROXY")
|
PreferenceGroup("PROXY")
|
||||||
PBMap\Options\Proxy = ReadPreferenceInteger("Proxy", #False)
|
\Proxy = ReadPreferenceInteger("Proxy", #False)
|
||||||
If PBMap\Options\Proxy
|
If \Proxy
|
||||||
PBMap\Options\ProxyURL = ReadPreferenceString("ProxyURL", "") ;InputRequester("ProxyServer", "Do you use a Proxy Server? Then enter the full url:", "")
|
\ProxyURL = ReadPreferenceString("ProxyURL", "") ;InputRequester("ProxyServer", "Do you use a Proxy Server? Then enter the full url:", "")
|
||||||
PBMap\Options\ProxyPort = ReadPreferenceString("ProxyPort", "") ;InputRequester("ProxyPort" , "Do you use a specific port? Then enter it", "")
|
\ProxyPort = ReadPreferenceString("ProxyPort", "") ;InputRequester("ProxyPort" , "Do you use a specific port? Then enter it", "")
|
||||||
PBMap\Options\ProxyUser = ReadPreferenceString("ProxyUser", "") ;InputRequester("ProxyUser" , "Do you use a user name? Then enter it", "")
|
\ProxyUser = ReadPreferenceString("ProxyUser", "") ;InputRequester("ProxyUser" , "Do you use a user name? Then enter it", "")
|
||||||
PBMap\Options\ProxyPassword = InputRequester("ProxyPass", "Do you use a password ? Then enter it", "") ;TODO
|
\ProxyPassword = InputRequester("ProxyPass", "Do you use a password ? Then enter it", "") ;TODO
|
||||||
EndIf
|
EndIf
|
||||||
PreferenceGroup("URL")
|
PreferenceGroup("URL")
|
||||||
PBMap\Options\DefaultOSMServer = ReadPreferenceString("DefaultOSMServer", "http://tile.openstreetmap.org/")
|
\DefaultOSMServer = ReadPreferenceString("DefaultOSMServer", "http://tile.openstreetmap.org/")
|
||||||
|
|
||||||
PreferenceGroup("PATHS")
|
PreferenceGroup("PATHS")
|
||||||
PBMap\Options\HDDCachePath = ReadPreferenceString("TilesCachePath", GetTemporaryDirectory())
|
\HDDCachePath = ReadPreferenceString("TilesCachePath", GetTemporaryDirectory())
|
||||||
PreferenceGroup("OPTIONS")
|
PreferenceGroup("OPTIONS")
|
||||||
PBMap\Options\WheelMouseRelative = ReadPreferenceInteger("WheelMouseRelative", #True)
|
\WheelMouseRelative = ReadPreferenceInteger("WheelMouseRelative", #True)
|
||||||
PBMap\Options\MaxMemCache = ReadPreferenceInteger("MaxMemCache", 20480) ;20 MiB, about 80 tiles in memory
|
\MaxMemCache = ReadPreferenceInteger("MaxMemCache", 20480) ;20 MiB, about 80 tiles in memory
|
||||||
PBMap\Options\ShowDegrees = ReadPreferenceInteger("ShowDegrees", #False)
|
\ShowDegrees = ReadPreferenceInteger("ShowDegrees", #False)
|
||||||
PBMap\Options\ShowDebugInfos = ReadPreferenceInteger("ShowDebugInfos", #False)
|
\ShowDebugInfos = ReadPreferenceInteger("ShowDebugInfos", #False)
|
||||||
PBMap\Options\ShowScale = ReadPreferenceInteger("ShowScale", #False)
|
\ShowScale = ReadPreferenceInteger("ShowScale", #False)
|
||||||
PBMap\Options\ShowMarkers = ReadPreferenceInteger("ShowMarkers", #True)
|
\ShowMarkers = ReadPreferenceInteger("ShowMarkers", #True)
|
||||||
PBMap\Options\ShowPointer = ReadPreferenceInteger("ShowPointer", #True)
|
\ShowPointer = ReadPreferenceInteger("ShowPointer", #True)
|
||||||
PBMap\Options\ShowTrack = ReadPreferenceInteger("ShowTrack", #True)
|
\ShowTrack = ReadPreferenceInteger("ShowTrack", #True)
|
||||||
PBMap\Options\ShowMarkersNb = ReadPreferenceInteger("ShowMarkersNb", #True)
|
\ShowTrackKms = ReadPreferenceInteger("ShowTrackKms", #False)
|
||||||
PBMap\Options\ShowMarkersLegend = ReadPreferenceInteger("ShowMarkersLegend", #False)
|
\ShowMarkersNb = ReadPreferenceInteger("ShowMarkersNb", #True)
|
||||||
PBMap\Options\TrackShowKms = ReadPreferenceInteger("TrackShowKms", #False)
|
\ShowMarkersLegend = ReadPreferenceInteger("ShowMarkersLegend", #False)
|
||||||
PBMap\Options\TimerInterval = 20
|
\TimerInterval = 20
|
||||||
|
PreferenceGroup("COLOURS")
|
||||||
|
\ColourFocus = ReadPreferenceInteger("ColourFocus", RGBA(255, 255, 0, 255))
|
||||||
ClosePreferences()
|
ClosePreferences()
|
||||||
|
EndWith
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
Procedure InitPBMap(Window)
|
Procedure InitPBMap(Window)
|
||||||
@@ -591,6 +619,11 @@ Module PBMap
|
|||||||
*Location\Latitude = Degree(ATan(SinH(#PI * (1.0 - 2.0 * *Coords\y / n))))
|
*Location\Latitude = Degree(ATan(SinH(#PI * (1.0 - 2.0 * *Coords\y / n))))
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
|
;Ensures the longitude to be in the range [-180;180[
|
||||||
|
Procedure.d ClipLongitude(Longitude.d)
|
||||||
|
ProcedureReturn Mod(Mod(Longitude + 180, 360.0) + 360.0, 360.0) - 180
|
||||||
|
EndProcedure
|
||||||
|
|
||||||
;Lat Lon coordinates 2 pixel absolute [0 to 2^Zoom * TileSize [
|
;Lat Lon coordinates 2 pixel absolute [0 to 2^Zoom * TileSize [
|
||||||
Procedure LatLon2Pixel(*Location.GeographicCoordinates, *Pixel.PixelCoordinates, Zoom)
|
Procedure LatLon2Pixel(*Location.GeographicCoordinates, *Pixel.PixelCoordinates, Zoom)
|
||||||
Protected tilemax = Pow(2.0, Zoom) * PBMap\TileSize
|
Protected tilemax = Pow(2.0, Zoom) * PBMap\TileSize
|
||||||
@@ -674,7 +707,6 @@ Module PBMap
|
|||||||
*MainNode=MainXMLNode(0)
|
*MainNode=MainXMLNode(0)
|
||||||
*MainNode=XMLNodeFromPath(*MainNode,"/gpx/trk/trkseg")
|
*MainNode=XMLNodeFromPath(*MainNode,"/gpx/trk/trkseg")
|
||||||
Protected *NewTrack.Tracks = AddElement(PBMap\TracksList())
|
Protected *NewTrack.Tracks = AddElement(PBMap\TracksList())
|
||||||
;ClearList(PBMap\track())
|
|
||||||
For child = 1 To XMLChildCount(*MainNode)
|
For child = 1 To XMLChildCount(*MainNode)
|
||||||
*child = ChildXMLNode(*MainNode, child)
|
*child = ChildXMLNode(*MainNode, child)
|
||||||
AddElement(*NewTrack\Track())
|
AddElement(*NewTrack\Track())
|
||||||
@@ -1044,7 +1076,7 @@ Module PBMap
|
|||||||
EndVectorLayer()
|
EndVectorLayer()
|
||||||
EndIf
|
EndIf
|
||||||
;Draw Distance
|
;Draw Distance
|
||||||
If PBMap\Options\TrackShowKms And ListSize(PBMap\TracksList()) > 0
|
If PBMap\Options\ShowTrackKms And ListSize(PBMap\TracksList()) > 0
|
||||||
BeginVectorLayer()
|
BeginVectorLayer()
|
||||||
ForEach PBMap\TracksList()
|
ForEach PBMap\TracksList()
|
||||||
km = 0 : memKm = -1
|
km = 0 : memKm = -1
|
||||||
@@ -1072,6 +1104,7 @@ Module PBMap
|
|||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
Procedure DrawMarker(x.i, y.i, Nb, Color.l, Legend.s, Focus.i, Selected.i)
|
Procedure DrawMarker(x.i, y.i, Nb, Color.l, Legend.s, Focus.i, Selected.i)
|
||||||
|
;Nice marker by yves86
|
||||||
VectorSourceColor(color)
|
VectorSourceColor(color)
|
||||||
MovePathCursor(x, y)
|
MovePathCursor(x, y)
|
||||||
AddPathLine(-8, -16, #PB_Path_Relative)
|
AddPathLine(-8, -16, #PB_Path_Relative)
|
||||||
@@ -1083,10 +1116,10 @@ Module PBMap
|
|||||||
VectorSourceColor(Color)
|
VectorSourceColor(Color)
|
||||||
FillPath(#PB_Path_Preserve)
|
FillPath(#PB_Path_Preserve)
|
||||||
If Focus
|
If Focus
|
||||||
VectorSourceColor(RGBA(255, 255, 0, 255))
|
VectorSourceColor(PBMap\Options\ColourFocus)
|
||||||
StrokePath(3)
|
StrokePath(3)
|
||||||
ElseIf Selected
|
ElseIf Selected
|
||||||
VectorSourceColor(RGBA(255, 255, 0, 255))
|
VectorSourceColor(PBMap\Options\ColourFocus)
|
||||||
StrokePath(4)
|
StrokePath(4)
|
||||||
Else
|
Else
|
||||||
VectorSourceColor(Color)
|
VectorSourceColor(Color)
|
||||||
@@ -1101,7 +1134,21 @@ Module PBMap
|
|||||||
EndIf
|
EndIf
|
||||||
If PBMap\Options\ShowMarkersLegend
|
If PBMap\Options\ShowMarkersLegend
|
||||||
VectorFont(FontID(PBMap\Font), 13)
|
VectorFont(FontID(PBMap\Font), 13)
|
||||||
Protected Height = VectorParagraphHeight(Legend, 100, 13)
|
; Protected Height = VectorParagraphHeight(Legend, 100, 13)
|
||||||
|
;dessin d'un cadre avec fond transparent
|
||||||
|
Protected Height = VectorParagraphHeight(Legend, 100, 100)
|
||||||
|
Protected Width.l
|
||||||
|
If Height < 20 ; une ligne
|
||||||
|
Width = VectorTextWidth(Legend)
|
||||||
|
Else
|
||||||
|
Width = 100
|
||||||
|
EndIf
|
||||||
|
AddPathBox(x - (Width / 2), y - 30 - Height, Width, Height)
|
||||||
|
VectorSourceColor(RGBA(168, 255, 255, 100))
|
||||||
|
FillPath()
|
||||||
|
AddPathBox(x - (Width / 2), y - 30 - Height, Width, Height)
|
||||||
|
VectorSourceColor(RGBA(36, 36, 255, 100))
|
||||||
|
StrokePath(2)
|
||||||
MovePathCursor(x - 50, y - 30 - Height)
|
MovePathCursor(x - 50, y - 30 - Height)
|
||||||
VectorSourceColor(RGBA(0, 0, 0, 255))
|
VectorSourceColor(RGBA(0, 0, 0, 255))
|
||||||
DrawVectorParagraph(Legend, 100, Height, #PB_VectorParagraph_Center)
|
DrawVectorParagraph(Legend, 100, Height, #PB_VectorParagraph_Center)
|
||||||
@@ -1330,7 +1377,7 @@ Module PBMap
|
|||||||
EndWith
|
EndWith
|
||||||
EndIf
|
EndIf
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
Procedure SetZoom(Zoom.i, mode.i = #PB_Relative)
|
Procedure SetZoom(Zoom.i, mode.i = #PB_Relative)
|
||||||
Select mode
|
Select mode
|
||||||
Case #PB_Relative
|
Case #PB_Relative
|
||||||
@@ -1447,11 +1494,41 @@ Module PBMap
|
|||||||
Case #PB_Shortcut_Delete
|
Case #PB_Shortcut_Delete
|
||||||
DeleteSelectedMarkers()
|
DeleteSelectedMarkers()
|
||||||
EndSelect
|
EndSelect
|
||||||
|
PBMap\Redraw = #True
|
||||||
If GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_Modifiers)&#PB_Canvas_Control = 0
|
If GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_Modifiers)&#PB_Canvas_Control = 0
|
||||||
CtrlKey = #False
|
CtrlKey = #False
|
||||||
EndIf
|
EndIf
|
||||||
Case #PB_EventType_KeyDown
|
Case #PB_EventType_KeyDown
|
||||||
If GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_Modifiers)&#PB_Canvas_Control <> 0
|
With PBMap\Markers()
|
||||||
|
Select GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_Key)
|
||||||
|
Case #PB_Shortcut_Left
|
||||||
|
ForEach PBMap\Markers()
|
||||||
|
If \Selected
|
||||||
|
\GeographicCoordinates\Longitude = ClipLongitude( \GeographicCoordinates\Longitude - 10* 360 / Pow(2, PBMap\Zoom + 8))
|
||||||
|
EndIf
|
||||||
|
Next
|
||||||
|
Case #PB_Shortcut_Up
|
||||||
|
ForEach PBMap\Markers()
|
||||||
|
If \Selected
|
||||||
|
\GeographicCoordinates\Latitude + 10* 360 / Pow(2, PBMap\Zoom + 8)
|
||||||
|
EndIf
|
||||||
|
Next
|
||||||
|
Case #PB_Shortcut_Right
|
||||||
|
ForEach PBMap\Markers()
|
||||||
|
If \Selected
|
||||||
|
\GeographicCoordinates\Longitude = ClipLongitude( \GeographicCoordinates\Longitude + 10* 360 / Pow(2, PBMap\Zoom + 8))
|
||||||
|
EndIf
|
||||||
|
Next
|
||||||
|
Case #PB_Shortcut_Down
|
||||||
|
ForEach PBMap\Markers()
|
||||||
|
If \Selected
|
||||||
|
\GeographicCoordinates\Latitude - 10* 360 / Pow(2, PBMap\Zoom + 8)
|
||||||
|
EndIf
|
||||||
|
Next
|
||||||
|
EndSelect
|
||||||
|
EndWith
|
||||||
|
PBMap\Redraw = #True
|
||||||
|
If GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_Modifiers)&#PB_Canvas_Control <> 0
|
||||||
CtrlKey = #True
|
CtrlKey = #True
|
||||||
EndIf
|
EndIf
|
||||||
Case #PB_EventType_LeftDoubleClick
|
Case #PB_EventType_LeftDoubleClick
|
||||||
@@ -1550,9 +1627,9 @@ Module PBMap
|
|||||||
If Distance(MarkerCoords\x, MarkerCoords\y, MouseX, MouseY) < 8
|
If Distance(MarkerCoords\x, MarkerCoords\y, MouseX, MouseY) < 8
|
||||||
PBMap\Markers()\Focus = #True
|
PBMap\Markers()\Focus = #True
|
||||||
Else
|
Else
|
||||||
If CtrlKey = #False
|
;If CtrlKey = #False
|
||||||
PBMap\Markers()\Focus = #False
|
PBMap\Markers()\Focus = #False
|
||||||
EndIf
|
;EndIf
|
||||||
EndIf
|
EndIf
|
||||||
Next
|
Next
|
||||||
EndIf
|
EndIf
|
||||||
@@ -1720,7 +1797,8 @@ CompilerIf #PB_Compiler_IsMainFile
|
|||||||
PBMap::SetOption("ShowDebugInfos", "0")
|
PBMap::SetOption("ShowDebugInfos", "0")
|
||||||
PBMap::SetOption("ShowScale", "1")
|
PBMap::SetOption("ShowScale", "1")
|
||||||
PBMap::SetOption("ShowMarkersLegend", "1")
|
PBMap::SetOption("ShowMarkersLegend", "1")
|
||||||
PBMap::SetOption("TrackShowKms", "1")
|
PBMap::SetOption("ShowTrackKms", "1")
|
||||||
|
PBMap::SetOption("ColourFocus", "$FFFF00AA")
|
||||||
PBMap::MapGadget(#Map, 10, 10, 512, 512)
|
PBMap::MapGadget(#Map, 10, 10, 512, 512)
|
||||||
PBMap::SetCallBackMainPointer(@MainPointer()) ; To change the main pointer (center of the view)
|
PBMap::SetCallBackMainPointer(@MainPointer()) ; To change the main pointer (center of the view)
|
||||||
PBMap::SetCallBackLocation(@UpdateLocation()) ; To obtain realtime coordinates
|
PBMap::SetCallBackLocation(@UpdateLocation()) ; To obtain realtime coordinates
|
||||||
@@ -1779,11 +1857,10 @@ CompilerIf #PB_Compiler_IsMainFile
|
|||||||
EndIf
|
EndIf
|
||||||
|
|
||||||
CompilerEndIf
|
CompilerEndIf
|
||||||
|
|
||||||
; IDE Options = PureBasic 5.50 (Windows - x64)
|
; IDE Options = PureBasic 5.50 (Windows - x64)
|
||||||
; CursorPosition = 1719
|
; CursorPosition = 1078
|
||||||
; FirstLine = 1707
|
; FirstLine = 1074
|
||||||
; Folding = -------------
|
; Folding = -------------
|
||||||
; EnableThread
|
; EnableThread
|
||||||
; EnableXP
|
; EnableXP
|
||||||
; DisableDebugger
|
|
||||||
; EnableUnicode
|
|
Reference in New Issue
Block a user