Cleaning and add

This commit is contained in:
djes
2016-07-25 12:30:33 +02:00
parent f7c7f0c02b
commit 90ce841007
2 changed files with 9821 additions and 113 deletions

9706
Roller.gpx Normal file

File diff suppressed because it is too large Load Diff

66
osm.pb
View File

@@ -90,7 +90,7 @@ Module OSM
Gadget.i ; Canvas Gadget Id
TargetLocation.Location ; Latitude and Longitude from focus point
*Drawing.DrawingParameters ; Focus Tile coord
*Drawing.DrawingParameters ; Drawing parameters based on focus point
CallBackLocation.i ; @Procedure(latitude.d,lontitude.d)
@@ -245,17 +245,17 @@ Module OSM
Global Proxy = #True
;- => Use this to customise your preferences
; Result = CreatePreferences(GetHomeDirectory() + "OSM.prefs")
; If Proxy
; PreferenceGroup("PROXY")
; WritePreferenceString("ProxyURL", "myproxy.fr")
; WritePreferenceString("ProxyPort", "myproxyport")
; WritePreferenceString("ProxyUser", "myproxyname")
; EndIf
; If Result
; ClosePreferences()
; EndIf
;- => Use this to customise your preferences
; Result = CreatePreferences(GetHomeDirectory() + "OSM.prefs")
; If Proxy
; PreferenceGroup("PROXY")
; WritePreferenceString("ProxyURL", "myproxy.fr")
; WritePreferenceString("ProxyPort", "myproxyport")
; WritePreferenceString("ProxyUser", "myproxyname")
; EndIf
; If Result
; ClosePreferences()
; EndIf
Result = OpenPreferences(GetHomeDirectory() + "OSM.prefs")
If Proxy
@@ -512,7 +512,7 @@ Module OSM
EndProcedure
Procedure DrawTiles()
Procedure DrawTiles(*Drawing.DrawingParameters)
Protected x.i, y.i
@@ -538,22 +538,25 @@ Module OSM
If *NewTile
With *NewTile
;Keep a track of tiles (especially to free memory)
AddElement(OSM\TilesThreads())
OSM\TilesThreads()\Tile = *NewTile
;New tile parameters
\x = CenterX + x * OSM\TileSize
\y = CenterY + y * OSM\TileSize
\OSMTileX = tx + x
\OSMTileY = ty + y
\OSMZoom = OSM\Zoom
;Check if the image exists, if not, load it in the background
;Check if the image exists
\nImage = GetTileFromMem(\OSMZoom, \OSMTileX, \OSMTileY)
If \nImage = -1
;If not, load it in the background
\GetImageThread = CreateThread(@GetImageThread(), *NewTile)
OSM\TilesThreads()\GetImageThread = \GetImageThread
EndIf
Debug " Creating get image thread nb " + Str(\GetImageThread)
EndIf
DrawTile(*NewTile)
EndWith
@@ -565,6 +568,8 @@ Module OSM
Next
Next
;Free tile memory when the loading thread has finished
;TODO : exit this proc from drawtiles in a special "free ressources" task
ForEach OSM\TilesThreads()
If IsThread(OSM\TilesThreads()\GetImageThread) = 0
FreeMemory(OSM\TilesThreads()\Tile)
@@ -621,7 +626,7 @@ Module OSM
Protected CenterX = GadgetWidth(OSM\Gadget) / 2
Protected CenterY = GadgetHeight(OSM\Gadget) / 2
DrawTiles()
DrawTiles(*Drawing)
LockMutex(OSM\DrawingMutex)
StartVectorDrawing(CanvasVectorOutput(OSM\Gadget))
@@ -634,7 +639,7 @@ Module OSM
;- Redraw
;If something was not correctly drawn, redraw after a while
If OSM\Dirty
If OSM\Dirty And OSM\EmergencyQuit = #False
Debug "Something was dirty ! We try again to redraw"
;Delay(250)
@@ -770,7 +775,7 @@ EndModule
;Demonstration
CompilerIf #PB_Compiler_IsMainFile
Enumeration
Enumeration
#Window_0
#Map
#Button_0
@@ -788,20 +793,20 @@ Enumeration
#String_0
#String_1
#Gdt_LoadGpx
EndEnumeration
EndEnumeration
Structure Location
Longitude.d
Latitude.d
EndStructure
Procedure UpdateLocation(*Location.Location)
Procedure UpdateLocation(*Location.Location)
SetGadgetText(#String_0,StrD(*Location\Latitude))
SetGadgetText(#String_1,StrD(*Location\Longitude))
ProcedureReturn 0
EndProcedure
;- Main
If OpenWindow(#Window_0, 260, 225, 700, 571, "OpenStreetMap", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_TitleBar | #PB_Window_ScreenCentered )
EndProcedure
;- Main
If OpenWindow(#Window_0, 260, 225, 700, 571, "OpenStreetMap", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_TitleBar | #PB_Window_ScreenCentered )
OSM::InitOSM()
LoadFont(0, "Wingdings", 12)
@@ -846,15 +851,12 @@ If OpenWindow(#Window_0, 260, 225, 700, 571, "OpenStreetMap", #PB_Window_System
EndSelect
EndSelect
Until Quit = #True
EndIf
<<<<<<< HEAD
=======
EndIf
CompilerEndIf
; IDE Options = PureBasic 5.42 LTS (Windows - x86)
; CursorPosition = 726
; FirstLine = 683
; IDE Options = PureBasic 5.42 LTS (Windows - x64)
; CursorPosition = 831
; FirstLine = 803
; Folding = -----
; EnableUnicode
; EnableThread
; EnableXP
>>>>>>> refs/remotes/origin/master