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

33
osm.pb
View File

@@ -82,14 +82,13 @@ Module OSM
Structure TileMemCach
Map Images.ImgMemCach()
Mutex.i
Semaphore.i
EndStructure
Structure Marker
Location.Location
color.l
EndStructure
;-OSM Structure
Structure OSM
Gadget.i ; Canvas Gadget Id
@@ -109,16 +108,13 @@ Module OSM
TileSize.i ; Tile size downloaded on the server ex : 256
HDDCachePath.S ; Path where to load and save tiles downloaded from server
MemCache.TileMemCach ; Image in memory cache
List MapImageIndex.ImgMemCach() ; Index from MemCache\Image() to construct map
MemCache.TileMemCach ; Images in memory cache
Moving.i
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()
MapImageMutex.i ; Mutex to lock
List track.Location() ;to display a GPX track
List Marker.Marker() ; To diplay marker
EditMarkerIndex.l
@@ -556,7 +552,7 @@ Module OSM
EndProcedure
Procedure Pointer(x.i, y.i, color.l = #Red)
Procedure Pointer(x.i, y.i, color.l = #Red)
color=RGBA(255, 0, 0, 255)
VectorSourceColor(color)
@@ -634,10 +630,11 @@ Module OSM
Debug "--------- Main drawing thread ------------"
*Drawing\Dirty = #False
Protected CenterX = GadgetWidth(OSM\Gadget) / 2
Protected CenterY = GadgetHeight(OSM\Gadget) / 2
*Drawing\Dirty = #False
StartVectorDrawing(CanvasVectorOutput(OSM\Gadget))
DrawTiles(*Drawing)
DrawTrack(*Drawing)
@@ -647,8 +644,7 @@ Module OSM
;- Redraw
;If something was not correctly drawn, redraw after a while
;Be sure that we're not modifying while moving
LockMutex(OSM\Drawing\Mutex)
LockMutex(OSM\Drawing\Mutex) ;Be sure that we're not modifying while moving (seems not useful, but it is, especially to clean the semaphore)
If *Drawing\Dirty
Debug "Something was dirty ! We try again to redraw"
;Delay(250)
@@ -656,7 +652,7 @@ Module OSM
SignalSemaphore(*Drawing\Semaphore)
Else
;Clean the semaphore to avoid multiple unuseful redraws
Repeat : Until TrySemaphore(*Drawing\Semaphore) = 0
Repeat : Until TrySemaphore(*Drawing\Semaphore) = 0
EndIf
UnlockMutex(OSM\Drawing\Mutex)
@@ -685,7 +681,7 @@ Module OSM
EndProcedure
Macro Min(a,b)
Macro Min(a,b)
(Bool((a) <= (b)) * (a) + Bool((b) < (a)) * (b))
EndMacro
@@ -693,8 +689,7 @@ Module OSM
(Bool((a) >= (b)) * (a) + Bool((b) > (a)) * (b))
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
;bounding box in long/lat coords (x=long, y=lat)
Protected MinY.d,MaxY.d,MinX.d,MaxX.d
@@ -766,10 +761,10 @@ Module OSM
EndProcedure
Procedure SetCallBackLocation(CallBackLocation.i)
OSM\CallBackLocation=CallBackLocation
OSM\CallBackLocation = CallBackLocation
EndProcedure
Procedure Event(Event.l)
Protected Gadget.i
@@ -958,8 +953,8 @@ CompilerIf #PB_Compiler_IsMainFile
CompilerEndIf
; IDE Options = PureBasic 5.42 LTS (Windows - x64)
; CursorPosition = 481
; FirstLine = 455
; CursorPosition = 757
; FirstLine = 705
; Folding = ------
; EnableUnicode
; EnableThread