This commit is contained in:
djes
2016-07-27 21:31:29 +02:00
parent 85b49e255d
commit 7e9de10496

21
osm.pb
View File

@@ -82,14 +82,13 @@ Module OSM
Structure TileMemCach Structure TileMemCach
Map Images.ImgMemCach() Map Images.ImgMemCach()
Mutex.i
Semaphore.i
EndStructure EndStructure
Structure Marker Structure Marker
Location.Location Location.Location
color.l color.l
EndStructure EndStructure
;-OSM Structure ;-OSM Structure
Structure OSM Structure OSM
Gadget.i ; Canvas Gadget Id Gadget.i ; Canvas Gadget Id
@@ -109,16 +108,13 @@ Module OSM
TileSize.i ; Tile size downloaded on the server ex : 256 TileSize.i ; Tile size downloaded on the server ex : 256
HDDCachePath.S ; Path where to load and save tiles downloaded from server HDDCachePath.S ; Path where to load and save tiles downloaded from server
MemCache.TileMemCach ; Image in memory cache MemCache.TileMemCach ; Images in memory cache
List MapImageIndex.ImgMemCach() ; Index from MemCache\Image() to construct map
Moving.i Moving.i
Dirty.i ;To signal that drawing need a refresh Dirty.i ;To signal that drawing need a refresh
;CurlMutex.i ;seems that I can't thread curl ! :((((( ;CurlMutex.i ;seems that I can't thread curl ! :(((((
List TilesThreads.TileThread() List TilesThreads.TileThread()
MapImageMutex.i ; Mutex to lock
List track.Location() ;to display a GPX track List track.Location() ;to display a GPX track
List Marker.Marker() ; To diplay marker List Marker.Marker() ; To diplay marker
EditMarkerIndex.l EditMarkerIndex.l
@@ -634,10 +630,11 @@ Module OSM
Debug "--------- Main drawing thread ------------" Debug "--------- Main drawing thread ------------"
*Drawing\Dirty = #False
Protected CenterX = GadgetWidth(OSM\Gadget) / 2 Protected CenterX = GadgetWidth(OSM\Gadget) / 2
Protected CenterY = GadgetHeight(OSM\Gadget) / 2 Protected CenterY = GadgetHeight(OSM\Gadget) / 2
*Drawing\Dirty = #False
StartVectorDrawing(CanvasVectorOutput(OSM\Gadget)) StartVectorDrawing(CanvasVectorOutput(OSM\Gadget))
DrawTiles(*Drawing) DrawTiles(*Drawing)
DrawTrack(*Drawing) DrawTrack(*Drawing)
@@ -647,8 +644,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
;Be sure that we're not modifying while moving LockMutex(OSM\Drawing\Mutex) ;Be sure that we're not modifying while moving (seems not useful, but it is, especially to clean the semaphore)
LockMutex(OSM\Drawing\Mutex)
If *Drawing\Dirty If *Drawing\Dirty
Debug "Something was dirty ! We try again to redraw" Debug "Something was dirty ! We try again to redraw"
;Delay(250) ;Delay(250)
@@ -693,7 +689,6 @@ Module OSM
(Bool((a) >= (b)) * (a) + Bool((b) > (a)) * (b)) (Bool((a) >= (b)) * (a) + Bool((b) > (a)) * (b))
EndMacro EndMacro
Procedure ZoomToArea() Procedure ZoomToArea()
;Source => http://gis.stackexchange.com/questions/19632/how-to-calculate-the-optimal-zoom-level-to-display-two-or-more-points-on-a-map ;Source => http://gis.stackexchange.com/questions/19632/how-to-calculate-the-optimal-zoom-level-to-display-two-or-more-points-on-a-map
;bounding box in long/lat coords (x=long, y=lat) ;bounding box in long/lat coords (x=long, y=lat)
@@ -766,10 +761,10 @@ Module OSM
EndProcedure EndProcedure
Procedure SetCallBackLocation(CallBackLocation.i) Procedure SetCallBackLocation(CallBackLocation.i)
OSM\CallBackLocation = CallBackLocation OSM\CallBackLocation = CallBackLocation
EndProcedure EndProcedure
Procedure Event(Event.l) Procedure Event(Event.l)
Protected Gadget.i Protected Gadget.i
@@ -958,8 +953,8 @@ CompilerIf #PB_Compiler_IsMainFile
CompilerEndIf CompilerEndIf
; IDE Options = PureBasic 5.42 LTS (Windows - x64) ; IDE Options = PureBasic 5.42 LTS (Windows - x64)
; CursorPosition = 481 ; CursorPosition = 757
; FirstLine = 455 ; FirstLine = 705
; Folding = ------ ; Folding = ------
; EnableUnicode ; EnableUnicode
; EnableThread ; EnableThread