bis
This commit is contained in:
110
PBMap.pb
110
PBMap.pb
@@ -26,8 +26,8 @@ DeclareModule PBMap
|
|||||||
#Red = 255
|
#Red = 255
|
||||||
|
|
||||||
;-Show debug infos
|
;-Show debug infos
|
||||||
Global Verbose = 1
|
Global Verbose = 0
|
||||||
Global MyDebugLevel = 4
|
Global MyDebugLevel = 0
|
||||||
|
|
||||||
#SCALE_NAUTICAL = 1
|
#SCALE_NAUTICAL = 1
|
||||||
#SCALE_KM = 0
|
#SCALE_KM = 0
|
||||||
@@ -264,7 +264,7 @@ Module PBMap
|
|||||||
|
|
||||||
;Send debug infos to stdout (allowing mixed debug infos with curl or other libs)
|
;Send debug infos to stdout (allowing mixed debug infos with curl or other libs)
|
||||||
Procedure MyDebug(msg.s, DbgLevel = 0)
|
Procedure MyDebug(msg.s, DbgLevel = 0)
|
||||||
If Verbose And MyDebugLevel >= DbgLevel
|
If Verbose And DbgLevel >= MyDebugLevel
|
||||||
PrintN(msg)
|
PrintN(msg)
|
||||||
;Debug msg
|
;Debug msg
|
||||||
EndIf
|
EndIf
|
||||||
@@ -300,7 +300,7 @@ Module PBMap
|
|||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
Procedure.i CurlReceiveHTTPToMemory(URL$, ProxyURL$="", ProxyPort$="", ProxyUser$="", ProxyPassword$="")
|
Procedure.i CurlReceiveHTTPToMemory(URL$, ProxyURL$="", ProxyPort$="", ProxyUser$="", ProxyPassword$="")
|
||||||
Protected *Buffer, curl.i, Timeout.i, res.i
|
Protected *Buffer, curl.i, Timeout.i, res.i, respcode.l
|
||||||
If Len(URL$)
|
If Len(URL$)
|
||||||
curl = curl_easy_init()
|
curl = curl_easy_init()
|
||||||
If curl
|
If curl
|
||||||
@@ -311,6 +311,10 @@ Module PBMap
|
|||||||
curl_easy_setopt(curl, #CURLOPT_HEADER, 0)
|
curl_easy_setopt(curl, #CURLOPT_HEADER, 0)
|
||||||
curl_easy_setopt(curl, #CURLOPT_FOLLOWLOCATION, 1)
|
curl_easy_setopt(curl, #CURLOPT_FOLLOWLOCATION, 1)
|
||||||
curl_easy_setopt(curl, #CURLOPT_TIMEOUT, Timeout)
|
curl_easy_setopt(curl, #CURLOPT_TIMEOUT, Timeout)
|
||||||
|
If Verbose
|
||||||
|
curl_easy_setopt(curl, #CURLOPT_VERBOSE, 1)
|
||||||
|
EndIf
|
||||||
|
curl_easy_setopt(curl, #CURLOPT_FAILONERROR, 1)
|
||||||
If Len(ProxyURL$)
|
If Len(ProxyURL$)
|
||||||
;curl_easy_setopt(curl, #CURLOPT_HTTPPROXYTUNNEL, #True)
|
;curl_easy_setopt(curl, #CURLOPT_HTTPPROXYTUNNEL, #True)
|
||||||
If Len(ProxyPort$)
|
If Len(ProxyPort$)
|
||||||
@@ -340,7 +344,10 @@ Module PBMap
|
|||||||
EndIf
|
EndIf
|
||||||
;curl_easy_cleanup(curl) ;Was its original place but moved below as it seems more logical to me.
|
;curl_easy_cleanup(curl) ;Was its original place but moved below as it seems more logical to me.
|
||||||
Else
|
Else
|
||||||
MyDebug("CURL problem", 4)
|
curl_easy_getinfo(curl, #CURLINFO_HTTP_CODE, @respcode)
|
||||||
|
MyDebug("CURL : HTTP ERROR " + Str(respcode) , 8)
|
||||||
|
curl_easy_cleanup(curl)
|
||||||
|
ProcedureReturn #False
|
||||||
EndIf
|
EndIf
|
||||||
curl_easy_cleanup(curl)
|
curl_easy_cleanup(curl)
|
||||||
Else
|
Else
|
||||||
@@ -357,10 +364,10 @@ Module PBMap
|
|||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
Procedure.i CurlReceiveHTTPToFile(URL$, DestFileName$, ProxyURL$="", ProxyPort$="", ProxyUser$="", ProxyPassword$="")
|
Procedure.i CurlReceiveHTTPToFile(URL$, DestFileName$, ProxyURL$="", ProxyPort$="", ProxyUser$="", ProxyPassword$="")
|
||||||
Protected *Buffer, curl.i, Timeout.i, res.i
|
Protected *Buffer, curl.i, Timeout.i, res.i, respcode.l
|
||||||
Protected FileHandle.i
|
Protected FileHandle.i
|
||||||
MyDebug("CurlReceiveHTTPToFile from " + URL$ + " " + ProxyURL$ + " " + ProxyPort$ + " " + ProxyUser$, 4)
|
MyDebug("CurlReceiveHTTPToFile from " + URL$ + " " + ProxyURL$ + " " + ProxyPort$ + " " + ProxyUser$, 8)
|
||||||
MyDebug(" to file : " + DestFileName$, 4)
|
MyDebug(" to file : " + DestFileName$, 8)
|
||||||
FileHandle = CreateFile(#PB_Any, DestFileName$)
|
FileHandle = CreateFile(#PB_Any, DestFileName$)
|
||||||
If FileHandle And Len(URL$)
|
If FileHandle And Len(URL$)
|
||||||
curl = curl_easy_init()
|
curl = curl_easy_init()
|
||||||
@@ -371,21 +378,24 @@ Module PBMap
|
|||||||
curl_easy_setopt(curl, #CURLOPT_SSL_VERIFYHOST, 0)
|
curl_easy_setopt(curl, #CURLOPT_SSL_VERIFYHOST, 0)
|
||||||
curl_easy_setopt(curl, #CURLOPT_HEADER, 0)
|
curl_easy_setopt(curl, #CURLOPT_HEADER, 0)
|
||||||
curl_easy_setopt(curl, #CURLOPT_FOLLOWLOCATION, 1)
|
curl_easy_setopt(curl, #CURLOPT_FOLLOWLOCATION, 1)
|
||||||
curl_easy_setopt(curl, #CURLOPT_TIMEOUT, Timeout)
|
curl_easy_setopt(curl, #CURLOPT_TIMEOUT, Timeout)
|
||||||
curl_easy_setopt(curl, #CURLOPT_VERBOSE, 0)
|
If Verbose
|
||||||
|
curl_easy_setopt(curl, #CURLOPT_VERBOSE, 1)
|
||||||
|
EndIf
|
||||||
|
curl_easy_setopt(curl, #CURLOPT_FAILONERROR, 1)
|
||||||
;curl_easy_setopt(curl, #CURLOPT_CONNECTTIMEOUT, 60)
|
;curl_easy_setopt(curl, #CURLOPT_CONNECTTIMEOUT, 60)
|
||||||
If Len(ProxyURL$)
|
If Len(ProxyURL$)
|
||||||
;curl_easy_setopt(curl, #CURLOPT_HTTPPROXYTUNNEL, #True)
|
;curl_easy_setopt(curl, #CURLOPT_HTTPPROXYTUNNEL, #True)
|
||||||
If Len(ProxyPort$)
|
If Len(ProxyPort$)
|
||||||
ProxyURL$ + ":" + ProxyPort$
|
ProxyURL$ + ":" + ProxyPort$
|
||||||
EndIf
|
EndIf
|
||||||
MyDebug( ProxyURL$)
|
MyDebug(ProxyURL$, 8)
|
||||||
curl_easy_setopt(curl, #CURLOPT_PROXY, str2curl(ProxyURL$))
|
curl_easy_setopt(curl, #CURLOPT_PROXY, str2curl(ProxyURL$))
|
||||||
If Len(ProxyUser$)
|
If Len(ProxyUser$)
|
||||||
If Len(ProxyPassword$)
|
If Len(ProxyPassword$)
|
||||||
ProxyUser$ + ":" + ProxyPassword$
|
ProxyUser$ + ":" + ProxyPassword$
|
||||||
EndIf
|
EndIf
|
||||||
MyDebug( ProxyUser$)
|
MyDebug(ProxyUser$, 8)
|
||||||
curl_easy_setopt(curl, #CURLOPT_PROXYUSERPWD, str2curl(ProxyUser$))
|
curl_easy_setopt(curl, #CURLOPT_PROXYUSERPWD, str2curl(ProxyUser$))
|
||||||
EndIf
|
EndIf
|
||||||
EndIf
|
EndIf
|
||||||
@@ -393,11 +403,15 @@ Module PBMap
|
|||||||
curl_easy_setopt(curl, #CURLOPT_WRITEFUNCTION, @ReceiveHTTPWriteToFileFunction())
|
curl_easy_setopt(curl, #CURLOPT_WRITEFUNCTION, @ReceiveHTTPWriteToFileFunction())
|
||||||
res = curl_easy_perform(curl)
|
res = curl_easy_perform(curl)
|
||||||
If res <> #CURLE_OK
|
If res <> #CURLE_OK
|
||||||
MyDebug("CURL problem", 4)
|
curl_easy_getinfo(curl, #CURLINFO_HTTP_CODE, @respcode)
|
||||||
|
MyDebug("CURL : HTTP ERROR " + Str(respcode) , 8)
|
||||||
|
CloseFile(FileHandle)
|
||||||
|
curl_easy_cleanup(curl)
|
||||||
|
ProcedureReturn #False
|
||||||
EndIf
|
EndIf
|
||||||
curl_easy_cleanup(curl)
|
curl_easy_cleanup(curl)
|
||||||
Else
|
Else
|
||||||
MyDebug("Can't init CURL", 4)
|
MyDebug("Can't init CURL", 8)
|
||||||
EndIf
|
EndIf
|
||||||
CloseFile(FileHandle)
|
CloseFile(FileHandle)
|
||||||
ProcedureReturn FileSize(DestFileName$)
|
ProcedureReturn FileSize(DestFileName$)
|
||||||
@@ -895,7 +909,7 @@ Module PBMap
|
|||||||
*Tile\RetryNb = 0
|
*Tile\RetryNb = 0
|
||||||
Else
|
Else
|
||||||
MyDebug("Image key : " + *Tile\key + " web image not correctly loaded", 3)
|
MyDebug("Image key : " + *Tile\key + " web image not correctly loaded", 3)
|
||||||
Delay(1000)
|
Delay(5000)
|
||||||
*Tile\RetryNb - 1
|
*Tile\RetryNb - 1
|
||||||
EndIf
|
EndIf
|
||||||
Until *Tile\RetryNb <= 0
|
Until *Tile\RetryNb <= 0
|
||||||
@@ -923,10 +937,9 @@ Module PBMap
|
|||||||
ProcedureReturn *timg
|
ProcedureReturn *timg
|
||||||
EndIf
|
EndIf
|
||||||
Else
|
Else
|
||||||
AddMapElement(PBMap\MemCache\Images(), key)
|
;PushMapPosition(PBMap\MemCache\Images())
|
||||||
PushMapPosition(PBMap\MemCache\Images())
|
|
||||||
;*** Cache management
|
;*** Cache management
|
||||||
; if cache size exceeds limit, try to delete the oldest tile used
|
; if cache size exceeds limit, try to delete the oldest tile used (first in the list)
|
||||||
Protected CacheSize = MapSize(PBMap\MemCache\Images()) * Pow(PBMap\TileSize, 2) * 4 ; Size of a tile = TileSize * TileSize * 4 bytes (RGBA)
|
Protected CacheSize = MapSize(PBMap\MemCache\Images()) * Pow(PBMap\TileSize, 2) * 4 ; Size of a tile = TileSize * TileSize * 4 bytes (RGBA)
|
||||||
Protected CacheLimit = PBMap\Options\MaxMemCache * 1024
|
Protected CacheLimit = PBMap\Options\MaxMemCache * 1024
|
||||||
MyDebug("Cache size : " + Str(CacheSize/1024) + " / CacheLimit : " + Str(CacheLimit/1024), 4)
|
MyDebug("Cache size : " + Str(CacheSize/1024) + " / CacheLimit : " + Str(CacheLimit/1024), 4)
|
||||||
@@ -942,9 +955,11 @@ Module PBMap
|
|||||||
CacheSize = MapSize(PBMap\MemCache\Images()) * Pow(PBMap\TileSize, 2) * 4 ; Size of a tile = TileSize * TileSize * 4 bytes (RGBA)
|
CacheSize = MapSize(PBMap\MemCache\Images()) * Pow(PBMap\TileSize, 2) * 4 ; Size of a tile = TileSize * TileSize * 4 bytes (RGBA)
|
||||||
EndIf
|
EndIf
|
||||||
Wend
|
Wend
|
||||||
PopMapPosition(PBMap\MemCache\Images())
|
LastElement(PBMap\MemCache\ImagesTimeStack())
|
||||||
|
;PopMapPosition(PBMap\MemCache\Images())
|
||||||
|
AddMapElement(PBMap\MemCache\Images(), key)
|
||||||
AddElement(PBMap\MemCache\ImagesTimeStack())
|
AddElement(PBMap\MemCache\ImagesTimeStack())
|
||||||
MoveElement(PBMap\MemCache\ImagesTimeStack(), #PB_List_Last)
|
;MoveElement(PBMap\MemCache\ImagesTimeStack(), #PB_List_Last)
|
||||||
PBMap\MemCache\ImagesTimeStack()\MapKey = MapKey(PBMap\MemCache\Images())
|
PBMap\MemCache\ImagesTimeStack()\MapKey = MapKey(PBMap\MemCache\Images())
|
||||||
;***
|
;***
|
||||||
MyDebug("Key : " + key + " added in memory cache!", 3)
|
MyDebug("Key : " + key + " added in memory cache!", 3)
|
||||||
@@ -957,7 +972,7 @@ Module PBMap
|
|||||||
If img <> -1
|
If img <> -1
|
||||||
MyDebug("Key : " + key + " found on HDD", 3)
|
MyDebug("Key : " + key + " found on HDD", 3)
|
||||||
*timg\nImage = img
|
*timg\nImage = img
|
||||||
*timg\Alpha = 0
|
*timg\Alpha = 256
|
||||||
ProcedureReturn *timg
|
ProcedureReturn *timg
|
||||||
EndIf
|
EndIf
|
||||||
MyDebug("Key : " + key + " not found on HDD", 3)
|
MyDebug("Key : " + key + " not found on HDD", 3)
|
||||||
@@ -1028,13 +1043,14 @@ Module PBMap
|
|||||||
*timg = GetTile(key, URL, CacheFile)
|
*timg = GetTile(key, URL, CacheFile)
|
||||||
If *timg\nImage <> -1
|
If *timg\nImage <> -1
|
||||||
MovePathCursor(px, py)
|
MovePathCursor(px, py)
|
||||||
DrawVectorImage(ImageID(*timg\nImage), *timg\Alpha)
|
If *timg\Alpha <= 224
|
||||||
If *timg\Alpha < 224
|
DrawVectorImage(ImageID(*timg\nImage), *timg\Alpha)
|
||||||
*timg\Alpha = (*timg\Alpha + 32) & $FF
|
*timg\Alpha + 32
|
||||||
PBMap\Redraw = #True
|
PBMap\Redraw = #True
|
||||||
Else
|
Else
|
||||||
*timg\Alpha = 255
|
DrawVectorImage(ImageID(*timg\nImage), 255)
|
||||||
EndIf
|
*timg\Alpha = 256
|
||||||
|
EndIf
|
||||||
Else
|
Else
|
||||||
MovePathCursor(px, py)
|
MovePathCursor(px, py)
|
||||||
DrawVectorImage(ImageID(PBMap\ImgLoading), 255)
|
DrawVectorImage(ImageID(PBMap\ImgLoading), 255)
|
||||||
@@ -1978,9 +1994,9 @@ Module PBMap
|
|||||||
CallFunctionFast(PBMap\CallBackLocation, @PBMap\GeographicCoordinates)
|
CallFunctionFast(PBMap\CallBackLocation, @PBMap\GeographicCoordinates)
|
||||||
EndIf
|
EndIf
|
||||||
EndIf
|
EndIf
|
||||||
PBMap\Redraw = #True
|
|
||||||
PBMap\MoveStartingPoint\x = GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_MouseX)
|
PBMap\MoveStartingPoint\x = GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_MouseX)
|
||||||
PBMap\MoveStartingPoint\y = GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_MouseY)
|
PBMap\MoveStartingPoint\y = GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_MouseY)
|
||||||
|
PBMap\Redraw = #True
|
||||||
Else
|
Else
|
||||||
LatLon2Pixel(@PBMap\GeographicCoordinates, @PBMap\PixelCoordinates, PBMap\Zoom)
|
LatLon2Pixel(@PBMap\GeographicCoordinates, @PBMap\PixelCoordinates, PBMap\Zoom)
|
||||||
MouseX = PBMap\PixelCoordinates\x - GadgetWidth(PBMap\Gadget) / 2 + GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_MouseX)
|
MouseX = PBMap\PixelCoordinates\x - GadgetWidth(PBMap\Gadget) / 2 + GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_MouseX)
|
||||||
@@ -1993,6 +2009,7 @@ Module PBMap
|
|||||||
LatLon2Pixel(@PBMap\Markers()\GeographicCoordinates, @MarkerCoords, PBMap\Zoom)
|
LatLon2Pixel(@PBMap\Markers()\GeographicCoordinates, @MarkerCoords, PBMap\Zoom)
|
||||||
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
|
||||||
|
PBMap\Redraw = #True
|
||||||
Else
|
Else
|
||||||
;If CtrlKey = #False
|
;If CtrlKey = #False
|
||||||
PBMap\Markers()\Focus = #False
|
PBMap\Markers()\Focus = #False
|
||||||
@@ -2007,7 +2024,7 @@ Module PBMap
|
|||||||
If ListSize(\Track()) > 0
|
If ListSize(\Track()) > 0
|
||||||
If \Visible
|
If \Visible
|
||||||
StartVectorDrawing(CanvasVectorOutput(PBMap\Gadget))
|
StartVectorDrawing(CanvasVectorOutput(PBMap\Gadget))
|
||||||
;Draw tracks
|
;Simulate tracks drawing
|
||||||
ForEach \Track()
|
ForEach \Track()
|
||||||
LatLon2PixelRel(@PBMap\TracksList()\Track(), @Pixel, PBMap\Zoom)
|
LatLon2PixelRel(@PBMap\TracksList()\Track(), @Pixel, PBMap\Zoom)
|
||||||
If ListIndex(\Track()) = 0
|
If ListIndex(\Track()) = 0
|
||||||
@@ -2018,6 +2035,7 @@ Module PBMap
|
|||||||
Next
|
Next
|
||||||
If IsInsideStroke(GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_MouseX), GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_MouseY), \StrokeWidth)
|
If IsInsideStroke(GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_MouseX), GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_MouseY), \StrokeWidth)
|
||||||
\Focus = #True
|
\Focus = #True
|
||||||
|
PBMap\Redraw = #True
|
||||||
Else
|
Else
|
||||||
\Focus = #False
|
\Focus = #False
|
||||||
EndIf
|
EndIf
|
||||||
@@ -2027,9 +2045,7 @@ Module PBMap
|
|||||||
Next
|
Next
|
||||||
EndIf
|
EndIf
|
||||||
EndWith
|
EndWith
|
||||||
|
|
||||||
EndIf
|
EndIf
|
||||||
PBMap\Redraw = #True
|
|
||||||
EndIf
|
EndIf
|
||||||
Case #PB_EventType_LeftButtonUp
|
Case #PB_EventType_LeftButtonUp
|
||||||
PBMap\MoveStartingPoint\x = - 1
|
PBMap\MoveStartingPoint\x = - 1
|
||||||
@@ -2135,6 +2151,12 @@ CompilerIf #PB_Compiler_IsMainFile
|
|||||||
#StringGeoLocationQuery
|
#StringGeoLocationQuery
|
||||||
EndEnumeration
|
EndEnumeration
|
||||||
|
|
||||||
|
;Menu events
|
||||||
|
Enumeration
|
||||||
|
#MenuEventLonLatStringEnter
|
||||||
|
#MenuEventGeoLocationStringEnter
|
||||||
|
EndEnumeration
|
||||||
|
|
||||||
Structure Location
|
Structure Location
|
||||||
Longitude.d
|
Longitude.d
|
||||||
Latitude.d
|
Latitude.d
|
||||||
@@ -2222,7 +2244,7 @@ CompilerIf #PB_Compiler_IsMainFile
|
|||||||
TextGadget(#TextGeoLocationQuery, 530, 435, 150, 15, "Enter an address")
|
TextGadget(#TextGeoLocationQuery, 530, 435, 150, 15, "Enter an address")
|
||||||
StringGadget(#StringGeoLocationQuery, 530, 450, 150, 20, "")
|
StringGadget(#StringGeoLocationQuery, 530, 450, 150, 20, "")
|
||||||
SetActiveGadget(#StringGeoLocationQuery)
|
SetActiveGadget(#StringGeoLocationQuery)
|
||||||
AddKeyboardShortcut(#Window_0, #PB_Shortcut_Return, 1)
|
AddKeyboardShortcut(#Window_0, #PB_Shortcut_Return, #MenuEventGeoLocationStringEnter)
|
||||||
;*** TODO : code to remove when the SetActiveGadget(-1) will be fixed
|
;*** TODO : code to remove when the SetActiveGadget(-1) will be fixed
|
||||||
CompilerIf #PB_Compiler_OS = #PB_OS_Linux
|
CompilerIf #PB_Compiler_OS = #PB_OS_Linux
|
||||||
Define Dummy = ButtonGadget(#PB_Any, 0, 0, 1, 1, "Dummy")
|
Define Dummy = ButtonGadget(#PB_Any, 0, 0, 1, 1, "Dummy")
|
||||||
@@ -2230,6 +2252,7 @@ CompilerIf #PB_Compiler_IsMainFile
|
|||||||
CompilerElse
|
CompilerElse
|
||||||
Define Dummy = -1
|
Define Dummy = -1
|
||||||
CompilerEndIf
|
CompilerEndIf
|
||||||
|
;***
|
||||||
Define Event.i, Gadget.i, Quit.b = #False
|
Define Event.i, Gadget.i, Quit.b = #False
|
||||||
Define pfValue.d
|
Define pfValue.d
|
||||||
Define OpenSeaMap = 0, Degrees = 1
|
Define OpenSeaMap = 0, Degrees = 1
|
||||||
@@ -2275,11 +2298,9 @@ CompilerIf #PB_Compiler_IsMainFile
|
|||||||
Case #StringLatitude, #StringLongitude
|
Case #StringLatitude, #StringLongitude
|
||||||
Select EventType()
|
Select EventType()
|
||||||
Case #PB_EventType_Focus
|
Case #PB_EventType_Focus
|
||||||
AddKeyboardShortcut(#Window_0, #PB_Shortcut_Return, 1)
|
AddKeyboardShortcut(#Window_0, #PB_Shortcut_Return, #MenuEventLonLatStringEnter)
|
||||||
Case #PB_EventType_LostFocus
|
Case #PB_EventType_LostFocus
|
||||||
RemoveKeyboardShortcut(#Window_0, #PB_Shortcut_Return)
|
RemoveKeyboardShortcut(#Window_0, #PB_Shortcut_Return)
|
||||||
PBMap::SetLocation(ValD(GetGadgetText(#StringLatitude)), ValD(GetGadgetText(#StringLongitude))) ; Change the PBMap coordinates
|
|
||||||
PBMap::Refresh()
|
|
||||||
EndSelect
|
EndSelect
|
||||||
Case #Gdt_AddMarker
|
Case #Gdt_AddMarker
|
||||||
PBMap::AddMarker(ValD(GetGadgetText(#StringLatitude)), ValD(GetGadgetText(#StringLongitude)), "", "Test", RGBA(Random(255), Random(255), Random(255), 255))
|
PBMap::AddMarker(ValD(GetGadgetText(#StringLatitude)), ValD(GetGadgetText(#StringLongitude)), "", "Test", RGBA(Random(255), Random(255), Random(255), 255))
|
||||||
@@ -2309,21 +2330,27 @@ CompilerIf #PB_Compiler_IsMainFile
|
|||||||
Case #StringGeoLocationQuery
|
Case #StringGeoLocationQuery
|
||||||
Select EventType()
|
Select EventType()
|
||||||
Case #PB_EventType_Focus
|
Case #PB_EventType_Focus
|
||||||
AddKeyboardShortcut(#Window_0, #PB_Shortcut_Return, 1)
|
AddKeyboardShortcut(#Window_0, #PB_Shortcut_Return, #MenuEventGeoLocationStringEnter)
|
||||||
Case #PB_EventType_LostFocus
|
Case #PB_EventType_LostFocus
|
||||||
RemoveKeyboardShortcut(#Window_0, #PB_Shortcut_Return)
|
RemoveKeyboardShortcut(#Window_0, #PB_Shortcut_Return)
|
||||||
PBMap::NominatimGeoLocationQuery(GetGadgetText(#StringGeoLocationQuery))
|
|
||||||
PBMap::Refresh()
|
|
||||||
EndSelect
|
EndSelect
|
||||||
EndSelect
|
EndSelect
|
||||||
Case #PB_Event_SizeWindow
|
Case #PB_Event_SizeWindow
|
||||||
ResizeAll()
|
ResizeAll()
|
||||||
Case #PB_Event_Menu
|
Case #PB_Event_Menu
|
||||||
|
;Receive "enter" key events
|
||||||
Select EventMenu()
|
Select EventMenu()
|
||||||
Case 1
|
Case #MenuEventGeoLocationStringEnter
|
||||||
|
If GetGadgetText(#StringGeoLocationQuery) <> ""
|
||||||
|
PBMap::NominatimGeoLocationQuery(GetGadgetText(#StringGeoLocationQuery))
|
||||||
|
PBMap::Refresh()
|
||||||
|
EndIf
|
||||||
;*** TODO : code to change when the SetActiveGadget(-1) will be fixed
|
;*** TODO : code to change when the SetActiveGadget(-1) will be fixed
|
||||||
SetActiveGadget(Dummy)
|
SetActiveGadget(Dummy)
|
||||||
;***
|
;***
|
||||||
|
Case #MenuEventLonLatStringEnter
|
||||||
|
PBMap::SetLocation(ValD(GetGadgetText(#StringLatitude)), ValD(GetGadgetText(#StringLongitude))) ; Change the PBMap coordinates
|
||||||
|
PBMap::Refresh()
|
||||||
EndSelect
|
EndSelect
|
||||||
EndSelect
|
EndSelect
|
||||||
Until Quit = #True
|
Until Quit = #True
|
||||||
@@ -2334,8 +2361,9 @@ CompilerIf #PB_Compiler_IsMainFile
|
|||||||
CompilerEndIf
|
CompilerEndIf
|
||||||
|
|
||||||
|
|
||||||
; IDE Options = PureBasic 5.42 LTS (Windows - x64)
|
; IDE Options = PureBasic 5.50 (Windows - x64)
|
||||||
; CursorPosition = 1015
|
; CursorPosition = 29
|
||||||
; FirstLine = 1007
|
|
||||||
; Folding = ----------------
|
; Folding = ----------------
|
||||||
; EnableThread
|
; EnableThread
|
||||||
|
; EnableXP
|
||||||
|
; EnableUnicode
|
Reference in New Issue
Block a user