Lil track update

This commit is contained in:
djes
2016-09-30 22:16:20 +02:00
parent 6de6c21de7
commit 717de5f6a3

View File

@@ -64,6 +64,7 @@ DeclareModule PBMap
Declare ClearTracks() Declare ClearTracks()
Declare DeleteTrack(*Ptr) Declare DeleteTrack(*Ptr)
Declare DeleteSelectedTracks() Declare DeleteSelectedTracks()
Declare SetTrackColour(*Ptr, Colour.i)
Declare.i AddMarker(Latitude.d, Longitude.d, Identifier.s = "", Legend.s = "", color.l=-1, CallBackPointer.i = -1) Declare.i AddMarker(Latitude.d, Longitude.d, Identifier.s = "", Legend.s = "", color.l=-1, CallBackPointer.i = -1)
Declare ClearMarkers() Declare ClearMarkers()
Declare DeleteMarker(*Ptr) Declare DeleteMarker(*Ptr)
@@ -1163,6 +1164,25 @@ Module PBMap
DrawVectorText(Str(dist)) DrawVectorText(Str(dist))
EndProcedure EndProcedure
Procedure TrackPointerFirst(x.i, y.i, dist.l)
Protected color.l
color=RGBA(0, 0, 0, 255)
MovePathCursor(x,y)
AddPathLine(-9,-17,#PB_Path_Relative)
AddPathLine(17,0,#PB_Path_Relative)
AddPathLine(-9,17,#PB_Path_Relative)
VectorSourceColor(color)
AddPathCircle(x,y-24,16)
FillPath()
VectorSourceColor(RGBA(255, 0, 0, 255))
AddPathCircle(x,y-24,14)
FillPath()
VectorFont(FontID(PBMap\Font), 14)
MovePathCursor(x-VectorTextWidth(Str(dist))/2, y-24-VectorTextHeight(Str(dist))/2)
VectorSourceColor(RGBA(0, 0, 0, 255))
DrawVectorText(Str(dist))
EndProcedure
Procedure DeleteTrack(*Ptr) Procedure DeleteTrack(*Ptr)
If *Ptr If *Ptr
ChangeCurrentElement(PBMap\TracksList(), *Ptr) ChangeCurrentElement(PBMap\TracksList(), *Ptr)
@@ -1184,6 +1204,14 @@ Module PBMap
PBMap\Redraw = #True PBMap\Redraw = #True
EndProcedure EndProcedure
Procedure SetTrackColour(*Ptr, Colour.i)
If *Ptr
ChangeCurrentElement(PBMap\TracksList(), *Ptr)
PBMap\TracksList()\Colour = Colour
PBMap\Redraw = #True
EndIf
EndProcedure
Procedure DrawTracks(*Drawing.DrawingParameters) Procedure DrawTracks(*Drawing.DrawingParameters)
Protected Pixel.PixelCoordinates Protected Pixel.PixelCoordinates
Protected Location.GeographicCoordinates Protected Location.GeographicCoordinates
@@ -1229,7 +1257,7 @@ Module PBMap
Next Next
EndVectorLayer() EndVectorLayer()
;Draw distances ;Draw distances
If PBMap\Options\ShowTrackKms If PBMap\Options\ShowTrackKms And PBMap\Zoom > 10
BeginVectorLayer() BeginVectorLayer()
ForEach PBMap\TracksList() ForEach PBMap\TracksList()
If \Visible If \Visible
@@ -1247,9 +1275,11 @@ Module PBMap
LatLon2PixelRel(@PBMap\TracksList()\Track(), @Pixel, PBMap\Zoom) LatLon2PixelRel(@PBMap\TracksList()\Track(), @Pixel, PBMap\Zoom)
If Int(km) <> memKm If Int(km) <> memKm
memKm = Int(km) memKm = Int(km)
If PBMap\Zoom > 10 If Int(km) = 0
TrackPointerFirst(Pixel\X , Pixel\Y, Int(km))
Else
TrackPointer(Pixel\X , Pixel\Y, Int(km)) TrackPointer(Pixel\X , Pixel\Y, Int(km))
EndIf EndIf
EndIf EndIf
Next Next
EndIf EndIf
@@ -2183,6 +2213,7 @@ CompilerIf #PB_Compiler_IsMainFile
Define Event.i, Gadget.i, Quit.b = #False Define Event.i, Gadget.i, Quit.b = #False
Define pfValue.d Define pfValue.d
Define OpenSeaMap = 0, Degrees = 1 Define OpenSeaMap = 0, Degrees = 1
Define *Track
;Our main gadget ;Our main gadget
PBMap::InitPBMap(#Window_0) PBMap::InitPBMap(#Window_0)
@@ -2219,7 +2250,8 @@ CompilerIf #PB_Compiler_IsMainFile
Case #Button_5 Case #Button_5
PBMap::SetZoom( - 1) PBMap::SetZoom( - 1)
Case #Gdt_LoadGpx Case #Gdt_LoadGpx
PBMap::LoadGpxFile(OpenFileRequester("Choose a file to load", "", "Gpx|*.gpx", 0)) *Track = PBMap::LoadGpxFile(OpenFileRequester("Choose a file to load", "", "Gpx|*.gpx", 0))
PBMap::SetTrackColour(*Track, RGBA(Random(255), Random(255), Random(255), 128))
Case #StringLatitude, #StringLongitude Case #StringLatitude, #StringLongitude
Select EventType() Select EventType()
Case #PB_EventType_Focus Case #PB_EventType_Focus
@@ -2280,8 +2312,8 @@ CompilerIf #PB_Compiler_IsMainFile
CompilerEndIf CompilerEndIf
; IDE Options = PureBasic 5.50 (Windows - x64) ; IDE Options = PureBasic 5.50 (Windows - x64)
; CursorPosition = 2183 ; CursorPosition = 1156
; FirstLine = 2166 ; FirstLine = 1144
; Folding = --------------- ; Folding = ----------------
; EnableThread ; EnableThread
; EnableXP ; EnableXP