Merge remote-tracking branch 'refs/remotes/origin/idle' into djes
# Conflicts: # PBMap.pb
This commit is contained in:
66
PBMap.pb
66
PBMap.pb
@@ -1,4 +1,4 @@
|
|||||||
;;**************************************************************
|
;**************************************************************
|
||||||
; Program: PBMap
|
; Program: PBMap
|
||||||
; Description: Permits the use of tiled maps like
|
; Description: Permits the use of tiled maps like
|
||||||
; OpenStreetMap in a handy PureBASIC module
|
; OpenStreetMap in a handy PureBASIC module
|
||||||
@@ -169,7 +169,6 @@ Module PBMap
|
|||||||
Dirty.i ; To signal that drawing need a refresh
|
Dirty.i ; To signal that drawing need a refresh
|
||||||
;
|
;
|
||||||
MainDrawingThread.i
|
MainDrawingThread.i
|
||||||
;List TilesThreads.TileThread()
|
|
||||||
TileThreadMutex.i; ;Mutex to protect resources
|
TileThreadMutex.i; ;Mutex to protect resources
|
||||||
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
|
||||||
@@ -544,12 +543,10 @@ Module PBMap
|
|||||||
If nImage <> -1
|
If nImage <> -1
|
||||||
MyDebug("Image key : " + *Tile\key + " web image loaded", 3)
|
MyDebug("Image key : " + *Tile\key + " web image loaded", 3)
|
||||||
*Tile\RetryNb = 0
|
*Tile\RetryNb = 0
|
||||||
; PostEvent(#PB_Event_Gadget, PBMap\Window, PBmap\Gadget, #PB_MAP_REDRAW, *Tile) ;If image is loaded from web, redraw
|
|
||||||
Else
|
Else
|
||||||
MyDebug("Image key : " + *Tile\key + " web image not correctly loaded", 3)
|
MyDebug("Image key : " + *Tile\key + " web image not correctly loaded", 3)
|
||||||
Delay(1000)
|
Delay(1000)
|
||||||
*Tile\RetryNb - 1
|
*Tile\RetryNb - 1
|
||||||
; PostEvent(#PB_Event_Gadget, PBMap\Window, PBmap\Gadget, #PB_MAP_RETRY, *Tile) ;If image is not loaded, retry
|
|
||||||
EndIf
|
EndIf
|
||||||
Until *Tile\RetryNb <= 0
|
Until *Tile\RetryNb <= 0
|
||||||
*Tile\nImage = nImage
|
*Tile\nImage = nImage
|
||||||
@@ -711,6 +708,7 @@ Module PBMap
|
|||||||
Procedure DrawDegrees(*Drawing.DrawingParameters,alpha=192)
|
Procedure DrawDegrees(*Drawing.DrawingParameters,alpha=192)
|
||||||
Protected tx, ty, nx,ny,nx1,ny1,x,y,n,cx,dperpixel.d
|
Protected tx, ty, nx,ny,nx1,ny1,x,y,n,cx,dperpixel.d
|
||||||
Protected pos1.PixelPosition,pos2.PixelPosition,Degrees1.Location,degrees2.Location
|
Protected pos1.PixelPosition,pos2.PixelPosition,Degrees1.Location,degrees2.Location
|
||||||
|
<<<<<<< HEAD
|
||||||
|
|
||||||
tx = Int(*Drawing\Position\x) ;Don't forget the Int() !
|
tx = Int(*Drawing\Position\x) ;Don't forget the Int() !
|
||||||
ty = Int(*Drawing\Position\y)
|
ty = Int(*Drawing\Position\y)
|
||||||
@@ -724,9 +722,25 @@ Module PBMap
|
|||||||
|
|
||||||
;VectorFont(FontID(PBMap\Font), 10)
|
;VectorFont(FontID(PBMap\Font), 10)
|
||||||
VectorSourceColor(RGBA(0, 0, 0,Alpha))
|
VectorSourceColor(RGBA(0, 0, 0,Alpha))
|
||||||
|
=======
|
||||||
|
>>>>>>> refs/remotes/origin/idle
|
||||||
|
|
||||||
;GetMapRegionDegrees(@Degrees1,@degrees2)
|
tx = *Drawing\Position\x
|
||||||
|
ty = *Drawing\Position\y
|
||||||
|
nx = *Drawing\CenterX / PBMap\TileSize ;How many tiles around the point
|
||||||
|
ny = *Drawing\CenterY / PBMap\TileSize
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
|
*Drawing\Bounds\NorthWest\x = tx-nx-1
|
||||||
|
*Drawing\Bounds\NorthWest\y = ty-ny-1
|
||||||
|
*Drawing\Bounds\SouthEast\x = tx+nx+1
|
||||||
|
*Drawing\Bounds\SouthEast\y = ty+ny+1
|
||||||
|
|
||||||
|
VectorFont(FontID(PBMap\Font), 10)
|
||||||
|
VectorSourceColor(RGBA(0, 0, 0,alpha))
|
||||||
|
|
||||||
|
>>>>>>> refs/remotes/origin/idle
|
||||||
XY2LatLon(*Drawing\Bounds\NorthWest, @Degrees1)
|
XY2LatLon(*Drawing\Bounds\NorthWest, @Degrees1)
|
||||||
XY2LatLon(*Drawing\Bounds\SouthEast, @Degrees2)
|
XY2LatLon(*Drawing\Bounds\SouthEast, @Degrees2)
|
||||||
|
|
||||||
@@ -736,15 +750,27 @@ Module PBMap
|
|||||||
ny1 = Round(Degrees2\Latitude, #PB_Round_Down)-1
|
ny1 = Round(Degrees2\Latitude, #PB_Round_Down)-1
|
||||||
|
|
||||||
GetPixelCoordFromLocation(@Degrees2, @pos2)
|
GetPixelCoordFromLocation(@Degrees2, @pos2)
|
||||||
|
<<<<<<< HEAD
|
||||||
|
|
||||||
|
=======
|
||||||
|
|
||||||
|
>>>>>>> refs/remotes/origin/idle
|
||||||
x = nx
|
x = nx
|
||||||
For y = ny1 To ny
|
For y = ny1 To ny
|
||||||
Degrees1\Longitude = x
|
Degrees1\Longitude = x
|
||||||
Degrees1\Latitude = y
|
Degrees1\Latitude = y
|
||||||
GetPixelCoordFromLocation(@Degrees1, @pos1)
|
GetPixelCoordFromLocation(@Degrees1, @pos1)
|
||||||
MovePathCursor(pos1\x, pos1\y)
|
MovePathCursor(pos1\x, pos1\y)
|
||||||
|
<<<<<<< HEAD
|
||||||
AddPathLine( pos2\x, pos1\y)
|
AddPathLine( pos2\x, pos1\y)
|
||||||
Next
|
Next
|
||||||
|
=======
|
||||||
|
AddPathLine( pos2\x, pos1\y)
|
||||||
|
MovePathCursor(10,pos1\y)
|
||||||
|
DrawVectorText(StrD(0-(90-Mod((y+90),180)),1))
|
||||||
|
Next
|
||||||
|
|
||||||
|
>>>>>>> refs/remotes/origin/idle
|
||||||
y = ny
|
y = ny
|
||||||
For x = nx To nx1
|
For x = nx To nx1
|
||||||
Degrees1\Longitude = x
|
Degrees1\Longitude = x
|
||||||
@@ -752,7 +778,13 @@ Module PBMap
|
|||||||
GetPixelCoordFromLocation(@Degrees1, @pos1)
|
GetPixelCoordFromLocation(@Degrees1, @pos1)
|
||||||
MovePathCursor(pos1\x, pos1\y)
|
MovePathCursor(pos1\x, pos1\y)
|
||||||
AddPathLine( pos1\x, pos2\y)
|
AddPathLine( pos1\x, pos2\y)
|
||||||
|
<<<<<<< HEAD
|
||||||
Next
|
Next
|
||||||
|
=======
|
||||||
|
MovePathCursor(pos1\x,10)
|
||||||
|
DrawVectorText(StrD(0-(180-Mod((x+180),360)),1))
|
||||||
|
Next
|
||||||
|
>>>>>>> refs/remotes/origin/idle
|
||||||
StrokePath(1)
|
StrokePath(1)
|
||||||
|
|
||||||
EndProcedure
|
EndProcedure
|
||||||
@@ -890,11 +922,15 @@ Module PBMap
|
|||||||
DrawScale(*Drawing,10,GadgetHeight(PBMAP\Gadget)-20,192)
|
DrawScale(*Drawing,10,GadgetHeight(PBMAP\Gadget)-20,192)
|
||||||
;EndIf
|
;EndIf
|
||||||
StopVectorDrawing()
|
StopVectorDrawing()
|
||||||
|
<<<<<<< HEAD
|
||||||
;If there was a problem while drawing, redraw
|
;If there was a problem while drawing, redraw
|
||||||
; If PBMap\Dirty
|
; If PBMap\Dirty
|
||||||
; PBMap\Redraw = #True
|
; PBMap\Redraw = #True
|
||||||
; ;PostEvent(#PB_Event_Gadget, PBMap\Window, PBmap\Gadget, #PB_MAP_REDRAW)
|
; ;PostEvent(#PB_Event_Gadget, PBMap\Window, PBmap\Gadget, #PB_MAP_REDRAW)
|
||||||
; EndIf
|
; EndIf
|
||||||
|
=======
|
||||||
|
|
||||||
|
>>>>>>> refs/remotes/origin/idle
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
Procedure Refresh()
|
Procedure Refresh()
|
||||||
@@ -1035,15 +1071,11 @@ Module PBMap
|
|||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
Procedure.d GetLatitude()
|
Procedure.d GetLatitude()
|
||||||
Protected Value.d
|
ProcedureReturn 0-(90-Mod((PBMap\TargetLocation\Latitude+90),180))
|
||||||
Value = PBMap\TargetLocation\Latitude
|
|
||||||
ProcedureReturn Value
|
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
Procedure.d GetLongitude()
|
Procedure.d GetLongitude()
|
||||||
Protected Value.d
|
ProcedureReturn 0-(180-Mod((PBMap\TargetLocation\Longitude+180),360))
|
||||||
Value = PBMap\TargetLocation\Longitude
|
|
||||||
ProcedureReturn Value
|
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
Procedure.i GetZoom()
|
Procedure.i GetZoom()
|
||||||
@@ -1192,8 +1224,8 @@ CompilerIf #PB_Compiler_IsMainFile
|
|||||||
EndStructure
|
EndStructure
|
||||||
|
|
||||||
Procedure UpdateLocation(*Location.Location)
|
Procedure UpdateLocation(*Location.Location)
|
||||||
SetGadgetText(#String_0, StrD(*Location\Latitude))
|
SetGadgetText(#String_0, StrD(0-(90-Mod((*Location\Latitude+90),180))))
|
||||||
SetGadgetText(#String_1, StrD(*Location\Longitude))
|
SetGadgetText(#String_1, StrD(0-(180-Mod((*Location\Longitude+180),360))))
|
||||||
ProcedureReturn 0
|
ProcedureReturn 0
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
@@ -1298,12 +1330,20 @@ CompilerIf #PB_Compiler_IsMainFile
|
|||||||
Until Quit = #True
|
Until Quit = #True
|
||||||
|
|
||||||
PBMap::Quit()
|
PBMap::Quit()
|
||||||
|
<<<<<<< HEAD
|
||||||
EndIf
|
EndIf
|
||||||
|
|
||||||
CompilerEndIf
|
CompilerEndIf
|
||||||
; IDE Options = PureBasic 5.50 (Windows - x64)
|
; IDE Options = PureBasic 5.50 (Windows - x64)
|
||||||
; CursorPosition = 751
|
; CursorPosition = 751
|
||||||
; FirstLine = 719
|
; FirstLine = 719
|
||||||
|
=======
|
||||||
|
EndIf
|
||||||
|
CompilerEndIf
|
||||||
|
; IDE Options = PureBasic 5.50 (Windows - x64)
|
||||||
|
; CursorPosition = 1263
|
||||||
|
; FirstLine = 1250
|
||||||
|
>>>>>>> refs/remotes/origin/idle
|
||||||
; Folding = ---------
|
; Folding = ---------
|
||||||
; EnableThread
|
; EnableThread
|
||||||
; EnableXP
|
; EnableXP
|
||||||
|
Reference in New Issue
Block a user