Merge branch 'thyphoon' into djes
This commit is contained in:
64
PBMap.pb
64
PBMap.pb
@@ -3,7 +3,7 @@
|
|||||||
; 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
|
||||||
; Author: Thyphoon, djes, Idle, yves86
|
; Author: Thyphoon, djes, Idle, yves86
|
||||||
; Date: June, 2017
|
; Date: July, 2017
|
||||||
; License: PBMap : Free, unrestricted, credit
|
; License: PBMap : Free, unrestricted, credit
|
||||||
; appreciated but not required.
|
; appreciated but not required.
|
||||||
; OSM : see http://www.openstreetmap.org/copyright
|
; OSM : see http://www.openstreetmap.org/copyright
|
||||||
@@ -46,6 +46,24 @@ DeclareModule PBMap
|
|||||||
#PB_MAP_RETRY = #PB_EventType_FirstCustomValue + 2
|
#PB_MAP_RETRY = #PB_EventType_FirstCustomValue + 2
|
||||||
#PB_MAP_TILE_CLEANUP = #PB_EventType_FirstCustomValue + 3
|
#PB_MAP_TILE_CLEANUP = #PB_EventType_FirstCustomValue + 3
|
||||||
|
|
||||||
|
;-*** Public structures
|
||||||
|
Structure GeographicCoordinates
|
||||||
|
Longitude.d
|
||||||
|
Latitude.d
|
||||||
|
EndStructure
|
||||||
|
|
||||||
|
Structure Marker
|
||||||
|
GeographicCoordinates.GeographicCoordinates ; Marker latitude and longitude
|
||||||
|
Identifier.s
|
||||||
|
Legend.s
|
||||||
|
Color.l ; Marker color
|
||||||
|
Focus.i
|
||||||
|
Selected.i ; Is the marker selected ?
|
||||||
|
CallBackPointer.i ; @Procedure(X.i, Y.i) to DrawPointer (you must use VectorDrawing lib)
|
||||||
|
EditWindow.i
|
||||||
|
EndStructure
|
||||||
|
;***
|
||||||
|
|
||||||
Declare InitPBMap(window)
|
Declare InitPBMap(window)
|
||||||
Declare SetDebugLevel(level.i)
|
Declare SetDebugLevel(level.i)
|
||||||
Declare SetOption(Option.s, Value.s)
|
Declare SetOption(Option.s, Value.s)
|
||||||
@@ -105,12 +123,7 @@ Module PBMap
|
|||||||
|
|
||||||
EnableExplicit
|
EnableExplicit
|
||||||
|
|
||||||
;-*** Structures
|
;-*** Internal Structures
|
||||||
|
|
||||||
Structure GeographicCoordinates
|
|
||||||
Longitude.d
|
|
||||||
Latitude.d
|
|
||||||
EndStructure
|
|
||||||
|
|
||||||
Structure PixelCoordinates
|
Structure PixelCoordinates
|
||||||
x.d
|
x.d
|
||||||
@@ -173,18 +186,7 @@ Module PBMap
|
|||||||
List ImagesTimeStack.ImgMemCachKey() ; Usage of the tile (first = older)
|
List ImagesTimeStack.ImgMemCachKey() ; Usage of the tile (first = older)
|
||||||
EndStructure
|
EndStructure
|
||||||
|
|
||||||
Structure Marker
|
;-Options Structure
|
||||||
GeographicCoordinates.GeographicCoordinates ; Marker latitude and longitude
|
|
||||||
Identifier.s
|
|
||||||
Legend.s
|
|
||||||
Color.l ; Marker color
|
|
||||||
Focus.i
|
|
||||||
Selected.i ; Is the marker selected ?
|
|
||||||
CallBackPointer.i ; @Procedure(X.i, Y.i) to DrawPointer (you must use VectorDrawing lib)
|
|
||||||
EditWindow.i
|
|
||||||
EndStructure
|
|
||||||
|
|
||||||
;-Options
|
|
||||||
Structure Option
|
Structure Option
|
||||||
HDDCachePath.s ; Path where to load and save tiles downloaded from server
|
HDDCachePath.s ; Path where to load and save tiles downloaded from server
|
||||||
DefaultOSMServer.s ; Base layer OSM server
|
DefaultOSMServer.s ; Base layer OSM server
|
||||||
@@ -265,7 +267,7 @@ Module PBMap
|
|||||||
StrokeWidth.i
|
StrokeWidth.i
|
||||||
EndStructure
|
EndStructure
|
||||||
|
|
||||||
;- PBMap
|
;- PBMap Structure
|
||||||
Structure PBMap
|
Structure PBMap
|
||||||
Window.i ; Parent Window
|
Window.i ; Parent Window
|
||||||
Gadget.i ; Canvas Gadget Id
|
Gadget.i ; Canvas Gadget Id
|
||||||
@@ -316,7 +318,7 @@ Module PBMap
|
|||||||
|
|
||||||
EndStructure
|
EndStructure
|
||||||
|
|
||||||
;-*** Global variables
|
;-*** Module's global variables
|
||||||
|
|
||||||
;-Show debug infos
|
;-Show debug infos
|
||||||
Global MyDebugLevel = 5
|
Global MyDebugLevel = 5
|
||||||
@@ -333,7 +335,7 @@ Module PBMap
|
|||||||
|
|
||||||
;- *** GetText - Translation purpose
|
;- *** GetText - Translation purpose
|
||||||
|
|
||||||
; TODO use this for all text
|
; TODO use this
|
||||||
IncludeFile "gettext.pbi"
|
IncludeFile "gettext.pbi"
|
||||||
|
|
||||||
;-*** Misc tools
|
;-*** Misc tools
|
||||||
@@ -825,7 +827,7 @@ Module PBMap
|
|||||||
EndSelect
|
EndSelect
|
||||||
EndWith
|
EndWith
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
; By default, save options in the user's home directory
|
; By default, save options in the user's home directory
|
||||||
Procedure SaveOptions(PreferencesFile.s = "PBMap.prefs")
|
Procedure SaveOptions(PreferencesFile.s = "PBMap.prefs")
|
||||||
If PreferencesFile = "PBMap.prefs"
|
If PreferencesFile = "PBMap.prefs"
|
||||||
@@ -946,7 +948,6 @@ Module PBMap
|
|||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
;-*** Layers
|
;-*** Layers
|
||||||
|
|
||||||
; Add a layer to a list (to get things ordered) and to a map (to access things easily)
|
; Add a layer to a list (to get things ordered) and to a map (to access things easily)
|
||||||
Procedure.i AddLayer(Name.s, Order.i, Alpha.d)
|
Procedure.i AddLayer(Name.s, Order.i, Alpha.d)
|
||||||
Protected *Ptr = 0
|
Protected *Ptr = 0
|
||||||
@@ -2530,7 +2531,7 @@ Module PBMap
|
|||||||
ForEach PBMap\Markers()
|
ForEach PBMap\Markers()
|
||||||
If PBMap\Markers()\Selected = #True
|
If PBMap\Markers()\Selected = #True
|
||||||
If PBMap\CallBackMarker > 0
|
If PBMap\CallBackMarker > 0
|
||||||
CallFunctionFast(PBMap\CallBackMarker, @PBMap\Markers()\GeographicCoordinates)
|
CallFunctionFast(PBMap\CallBackMarker, @PBMap\Markers());
|
||||||
EndIf
|
EndIf
|
||||||
EndIf
|
EndIf
|
||||||
Next
|
Next
|
||||||
@@ -2719,6 +2720,10 @@ CompilerIf #PB_Compiler_IsMainFile
|
|||||||
EndIf
|
EndIf
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
|
Procedure MarkerMoveCallBack(*Marker.PBMap::Marker)
|
||||||
|
Debug "Identifier : " + *Marker\Identifier + "(" + StrD(*Marker\GeographicCoordinates\Latitude) + ", " + StrD(*Marker\GeographicCoordinates\Longitude) + ")"
|
||||||
|
EndProcedure
|
||||||
|
|
||||||
Procedure MainPointer(x.i, y.i)
|
Procedure MainPointer(x.i, y.i)
|
||||||
VectorSourceColor(RGBA(255, 255,255, 255)) : AddPathCircle(x, y,32) : StrokePath(1)
|
VectorSourceColor(RGBA(255, 255,255, 255)) : AddPathCircle(x, y,32) : StrokePath(1)
|
||||||
VectorSourceColor(RGBA(0, 0, 0, 255)) : AddPathCircle(x, y, 29):StrokePath(2)
|
VectorSourceColor(RGBA(0, 0, 0, 255)) : AddPathCircle(x, y, 29):StrokePath(2)
|
||||||
@@ -2818,6 +2823,7 @@ CompilerIf #PB_Compiler_IsMainFile
|
|||||||
PBMap::SetLocation(-36.81148, 175.08634,12) ; Change the PBMap coordinates
|
PBMap::SetLocation(-36.81148, 175.08634,12) ; Change the PBMap coordinates
|
||||||
PBMAP::SetMapScaleUnit(PBMAP::#SCALE_KM) ; To change the scale unit
|
PBMAP::SetMapScaleUnit(PBMAP::#SCALE_KM) ; To change the scale unit
|
||||||
PBMap::AddMarker(49.0446828398, 2.0349812508, "", "", -1, @MyMarker()) ; To add a marker with a customised GFX
|
PBMap::AddMarker(49.0446828398, 2.0349812508, "", "", -1, @MyMarker()) ; To add a marker with a customised GFX
|
||||||
|
PBMap::SetCallBackMarker(@MarkerMoveCallBack())
|
||||||
|
|
||||||
Repeat
|
Repeat
|
||||||
Event = WaitWindowEvent()
|
Event = WaitWindowEvent()
|
||||||
@@ -2948,11 +2954,11 @@ CompilerIf #PB_Compiler_IsMainFile
|
|||||||
|
|
||||||
CompilerEndIf
|
CompilerEndIf
|
||||||
|
|
||||||
|
|
||||||
; IDE Options = PureBasic 5.60 (Windows - x64)
|
; IDE Options = PureBasic 5.60 (Windows - x64)
|
||||||
; CursorPosition = 1404
|
; CursorPosition = 2727
|
||||||
; FirstLine = 1249
|
; FirstLine = 2720
|
||||||
; Folding = --------------------
|
; Folding = --------------------
|
||||||
; EnableThread
|
; EnableThread
|
||||||
; EnableXP
|
; EnableXP
|
||||||
; CompileSourceDirectory
|
; CompileSourceDirectory
|
||||||
; DisablePurifier = 1,1,1,1
|
|
Reference in New Issue
Block a user