Cleaning and add
This commit is contained in:
9706
Roller.gpx
Normal file
9706
Roller.gpx
Normal file
File diff suppressed because it is too large
Load Diff
30
osm.pb
30
osm.pb
@@ -90,7 +90,7 @@ Module OSM
|
|||||||
Gadget.i ; Canvas Gadget Id
|
Gadget.i ; Canvas Gadget Id
|
||||||
|
|
||||||
TargetLocation.Location ; Latitude and Longitude from focus point
|
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)
|
CallBackLocation.i ; @Procedure(latitude.d,lontitude.d)
|
||||||
|
|
||||||
@@ -512,7 +512,7 @@ Module OSM
|
|||||||
|
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
Procedure DrawTiles()
|
Procedure DrawTiles(*Drawing.DrawingParameters)
|
||||||
|
|
||||||
Protected x.i, y.i
|
Protected x.i, y.i
|
||||||
|
|
||||||
@@ -538,22 +538,25 @@ Module OSM
|
|||||||
If *NewTile
|
If *NewTile
|
||||||
With *NewTile
|
With *NewTile
|
||||||
|
|
||||||
|
;Keep a track of tiles (especially to free memory)
|
||||||
AddElement(OSM\TilesThreads())
|
AddElement(OSM\TilesThreads())
|
||||||
OSM\TilesThreads()\Tile = *NewTile
|
OSM\TilesThreads()\Tile = *NewTile
|
||||||
|
|
||||||
|
;New tile parameters
|
||||||
\x = CenterX + x * OSM\TileSize
|
\x = CenterX + x * OSM\TileSize
|
||||||
\y = CenterY + y * OSM\TileSize
|
\y = CenterY + y * OSM\TileSize
|
||||||
\OSMTileX = tx + x
|
\OSMTileX = tx + x
|
||||||
\OSMTileY = ty + y
|
\OSMTileY = ty + y
|
||||||
\OSMZoom = OSM\Zoom
|
\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)
|
\nImage = GetTileFromMem(\OSMZoom, \OSMTileX, \OSMTileY)
|
||||||
If \nImage = -1
|
If \nImage = -1
|
||||||
|
;If not, load it in the background
|
||||||
\GetImageThread = CreateThread(@GetImageThread(), *NewTile)
|
\GetImageThread = CreateThread(@GetImageThread(), *NewTile)
|
||||||
|
|
||||||
OSM\TilesThreads()\GetImageThread = \GetImageThread
|
OSM\TilesThreads()\GetImageThread = \GetImageThread
|
||||||
EndIf
|
|
||||||
Debug " Creating get image thread nb " + Str(\GetImageThread)
|
Debug " Creating get image thread nb " + Str(\GetImageThread)
|
||||||
|
EndIf
|
||||||
DrawTile(*NewTile)
|
DrawTile(*NewTile)
|
||||||
|
|
||||||
EndWith
|
EndWith
|
||||||
@@ -565,6 +568,8 @@ Module OSM
|
|||||||
Next
|
Next
|
||||||
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()
|
ForEach OSM\TilesThreads()
|
||||||
If IsThread(OSM\TilesThreads()\GetImageThread) = 0
|
If IsThread(OSM\TilesThreads()\GetImageThread) = 0
|
||||||
FreeMemory(OSM\TilesThreads()\Tile)
|
FreeMemory(OSM\TilesThreads()\Tile)
|
||||||
@@ -621,7 +626,7 @@ Module OSM
|
|||||||
Protected CenterX = GadgetWidth(OSM\Gadget) / 2
|
Protected CenterX = GadgetWidth(OSM\Gadget) / 2
|
||||||
Protected CenterY = GadgetHeight(OSM\Gadget) / 2
|
Protected CenterY = GadgetHeight(OSM\Gadget) / 2
|
||||||
|
|
||||||
DrawTiles()
|
DrawTiles(*Drawing)
|
||||||
|
|
||||||
LockMutex(OSM\DrawingMutex)
|
LockMutex(OSM\DrawingMutex)
|
||||||
StartVectorDrawing(CanvasVectorOutput(OSM\Gadget))
|
StartVectorDrawing(CanvasVectorOutput(OSM\Gadget))
|
||||||
@@ -634,7 +639,7 @@ Module OSM
|
|||||||
|
|
||||||
;- Redraw
|
;- Redraw
|
||||||
;If something was not correctly drawn, redraw after a while
|
;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"
|
Debug "Something was dirty ! We try again to redraw"
|
||||||
;Delay(250)
|
;Delay(250)
|
||||||
|
|
||||||
@@ -847,14 +852,11 @@ If OpenWindow(#Window_0, 260, 225, 700, 571, "OpenStreetMap", #PB_Window_System
|
|||||||
EndSelect
|
EndSelect
|
||||||
Until Quit = #True
|
Until Quit = #True
|
||||||
EndIf
|
EndIf
|
||||||
<<<<<<< HEAD
|
|
||||||
=======
|
|
||||||
CompilerEndIf
|
CompilerEndIf
|
||||||
; IDE Options = PureBasic 5.42 LTS (Windows - x86)
|
|
||||||
; CursorPosition = 726
|
; IDE Options = PureBasic 5.42 LTS (Windows - x64)
|
||||||
; FirstLine = 683
|
; CursorPosition = 831
|
||||||
|
; FirstLine = 803
|
||||||
; Folding = -----
|
; Folding = -----
|
||||||
; EnableUnicode
|
; EnableUnicode
|
||||||
; EnableThread
|
|
||||||
; EnableXP
|
; EnableXP
|
||||||
>>>>>>> refs/remotes/origin/master
|
|
||||||
|
Reference in New Issue
Block a user