Latest HERE and proxy fixes

This commit is contained in:
djes
2017-03-15 20:17:27 +01:00
parent 799e61ce4e
commit f2cb4f08e9

View File

@@ -289,7 +289,7 @@ Module PBMap
;-*** Global variables ;-*** Global variables
;-Show debug infos ;-Show debug infos
Global MyDebugLevel = 2 Global MyDebugLevel = 0
Global PBMap.PBMap, Null.i Global PBMap.PBMap, Null.i
Global slash.s Global slash.s
@@ -759,7 +759,7 @@ Module PBMap
PreferenceGroup("OPTIONS") PreferenceGroup("OPTIONS")
\WheelMouseRelative = ReadPreferenceInteger("WheelMouseRelative", #True) \WheelMouseRelative = ReadPreferenceInteger("WheelMouseRelative", #True)
\MaxMemCache = ReadPreferenceInteger("MaxMemCache", 20480) ;20 MiB, about 80 tiles in memory \MaxMemCache = ReadPreferenceInteger("MaxMemCache", 20480) ;20 MiB, about 80 tiles in memory
\Verbose = ReadPreferenceInteger("Verbose", #True) \Verbose = ReadPreferenceInteger("Verbose", #False)
\Warning = ReadPreferenceInteger("Warning", #False) \Warning = ReadPreferenceInteger("Warning", #False)
\ShowDegrees = ReadPreferenceInteger("ShowDegrees", #False) \ShowDegrees = ReadPreferenceInteger("ShowDegrees", #False)
\ShowDebugInfos = ReadPreferenceInteger("ShowDebugInfos", #False) \ShowDebugInfos = ReadPreferenceInteger("ShowDebugInfos", #False)
@@ -893,13 +893,15 @@ Module PBMap
Protected *Buffer Protected *Buffer
Protected nImage.i = -1 Protected nImage.i = -1
Protected FileSize.i, timg Protected FileSize.i, timg
HTTPProxy(PBMap\Options\ProxyURL + ":" + PBMap\Options\ProxyPort, PBMap\Options\ProxyUser, PBMap\Options\ProxyPassword) If PBMap\Options\Proxy
HTTPProxy(PBMap\Options\ProxyURL + ":" + PBMap\Options\ProxyPort, PBMap\Options\ProxyUser, PBMap\Options\ProxyPassword)
EndIf
FileSize = ReceiveHTTPFile(TileURL, CacheFile) FileSize = ReceiveHTTPFile(TileURL, CacheFile)
If FileSize > 0 If FileSize > 0
MyDebug("Loaded from web " + TileURL + " as CacheFile " + CacheFile, 3) MyDebug("Loaded from web " + TileURL + " as CacheFile " + CacheFile, 3)
nImage = GetTileFromHDD(CacheFile) nImage = GetTileFromHDD(CacheFile)
Else Else
MyDebug("Problem loading from web " + TileURL, 3) MyDebug("Problem loading from web " + TileURL + " as CacheFile " + CacheFile, 3)
EndIf EndIf
; **** IMPORTANT NOTICE (please not remove) ; **** IMPORTANT NOTICE (please not remove)
; I'm (djes) now using Curl (actually, just normal pb) only, as this original catchimage/saveimage method is a double operation (uncompress/recompress PNG) ; I'm (djes) now using Curl (actually, just normal pb) only, as this original catchimage/saveimage method is a double operation (uncompress/recompress PNG)
@@ -1896,7 +1898,9 @@ Module PBMap
; Debug *Buffer ; Debug *Buffer
; Debug MemorySize(*Buffer) ; Debug MemorySize(*Buffer)
; Protected JSon.s = PeekS(*Buffer, MemorySize(*Buffer), #PB_UTF8) ; Protected JSon.s = PeekS(*Buffer, MemorySize(*Buffer), #PB_UTF8)
HTTPProxy(PBMap\Options\ProxyURL + ":" + PBMap\Options\ProxyPort, PBMap\Options\ProxyUser, PBMap\Options\ProxyPassword) If PBMap\Options\Proxy
HTTPProxy(PBMap\Options\ProxyURL + ":" + PBMap\Options\ProxyPort, PBMap\Options\ProxyUser, PBMap\Options\ProxyPassword)
EndIf
Size = ReceiveHTTPFile(Query, JSONFileName) Size = ReceiveHTTPFile(Query, JSONFileName)
If LoadJSON(0, JSONFileName) = 0 If LoadJSON(0, JSONFileName) = 0
;Demivec's code ;Demivec's code
@@ -2477,7 +2481,8 @@ CompilerIf #PB_Compiler_IsMainFile
PBMap::DeleteLayer("Here") PBMap::DeleteLayer("Here")
SetGadgetState(#Gdt_AddHereMap, 0) SetGadgetState(#Gdt_AddHereMap, 0)
Else Else
PBMap::AddHereServerLayer("Here", 2) ; Add a here overlay map on layer nb 2 MessageRequester("Info", "Don't forget to register on HERE and change the line 2485 or edit options file")
PBMap::AddHereServerLayer("Here", 2, "my_id", "my_code") ; Add a here overlay map on layer nb 2
SetGadgetState(#Gdt_AddHereMap, 1) SetGadgetState(#Gdt_AddHereMap, 1)
EndIf EndIf
PBMap::Refresh() PBMap::Refresh()
@@ -2529,10 +2534,11 @@ CompilerIf #PB_Compiler_IsMainFile
CompilerEndIf CompilerEndIf
; IDE Options = PureBasic 5.50 (Windows - x64) ; IDE Options = PureBasic 5.60 (Windows - x64)
; CursorPosition = 2530 ; CursorPosition = 2475
; FirstLine = 2476 ; FirstLine = 2453
; Folding = ------------------ ; Folding = ------------------
; EnableThread ; EnableThread
; EnableXP ; EnableXP
; DisableDebugger
; EnableUnicode ; EnableUnicode