Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
7c32502fe3 | ||
![]() |
6a91b81bc7 | ||
![]() |
287bd29104 | ||
![]() |
926b2c5c16 | ||
![]() |
29c1b39507 |
355
PBMap.pb
355
PBMap.pb
@@ -26,8 +26,8 @@ DeclareModule PBMap
|
|||||||
#Red = 255
|
#Red = 255
|
||||||
|
|
||||||
;-Show debug infos
|
;-Show debug infos
|
||||||
Global Verbose = 1
|
Global Verbose = 0
|
||||||
Global MyDebugLevel = 4
|
Global MyDebugLevel = 0
|
||||||
|
|
||||||
#SCALE_NAUTICAL = 1
|
#SCALE_NAUTICAL = 1
|
||||||
#SCALE_KM = 0
|
#SCALE_KM = 0
|
||||||
@@ -55,6 +55,7 @@ DeclareModule PBMap
|
|||||||
Declare MapGadget(Gadget.i, X.i, Y.i, Width.i, Height.i)
|
Declare MapGadget(Gadget.i, X.i, Y.i, Width.i, Height.i)
|
||||||
Declare SetLocation(latitude.d, longitude.d, Zoom = -1, mode.i = #PB_Absolute)
|
Declare SetLocation(latitude.d, longitude.d, Zoom = -1, mode.i = #PB_Absolute)
|
||||||
Declare Drawing()
|
Declare Drawing()
|
||||||
|
Declare SetAngle(Angle.d, Mode = #PB_Absolute)
|
||||||
Declare SetZoom(Zoom.i, mode.i = #PB_Relative)
|
Declare SetZoom(Zoom.i, mode.i = #PB_Relative)
|
||||||
Declare ZoomToArea(MinY.d, MaxY.d, MinX.d, MaxX.d)
|
Declare ZoomToArea(MinY.d, MaxY.d, MinX.d, MaxX.d)
|
||||||
Declare ZoomToTracks(*Tracks)
|
Declare ZoomToTracks(*Tracks)
|
||||||
@@ -77,6 +78,7 @@ DeclareModule PBMap
|
|||||||
Declare.d GetLongitude()
|
Declare.d GetLongitude()
|
||||||
Declare.d MouseLatitude()
|
Declare.d MouseLatitude()
|
||||||
Declare.d MouseLongitude()
|
Declare.d MouseLongitude()
|
||||||
|
Declare.d GetAngle()
|
||||||
Declare.i GetZoom()
|
Declare.i GetZoom()
|
||||||
Declare.i GetMode()
|
Declare.i GetMode()
|
||||||
Declare SetMode(Mode.i = #MODE_DEFAULT)
|
Declare SetMode(Mode.i = #MODE_DEFAULT)
|
||||||
@@ -88,8 +90,8 @@ Module PBMap
|
|||||||
EnableExplicit
|
EnableExplicit
|
||||||
|
|
||||||
Structure PixelCoordinates
|
Structure PixelCoordinates
|
||||||
x.i
|
x.d
|
||||||
y.i
|
y.d
|
||||||
EndStructure
|
EndStructure
|
||||||
|
|
||||||
Structure Coordinates
|
Structure Coordinates
|
||||||
@@ -110,12 +112,14 @@ Module PBMap
|
|||||||
Structure BoundingBox
|
Structure BoundingBox
|
||||||
NorthWest.GeographicCoordinates
|
NorthWest.GeographicCoordinates
|
||||||
SouthEast.GeographicCoordinates
|
SouthEast.GeographicCoordinates
|
||||||
|
BottomLeft.PixelCoordinates
|
||||||
|
TopRight.PixelCoordinates
|
||||||
EndStructure
|
EndStructure
|
||||||
|
|
||||||
Structure DrawingParameters
|
Structure DrawingParameters
|
||||||
Canvas.i
|
Canvas.i
|
||||||
CenterX.i ; Gadget center in screen relative pixels
|
CenterX.d ; Gadget center in screen relative pixels
|
||||||
CenterY.i
|
CenterY.d
|
||||||
GeographicCoordinates.GeographicCoordinates ; Real center
|
GeographicCoordinates.GeographicCoordinates ; Real center
|
||||||
TileCoordinates.Coordinates ; Center coordinates in tile.decimal
|
TileCoordinates.Coordinates ; Center coordinates in tile.decimal
|
||||||
Bounds.BoundingBox ; Drawing boundaries in lat/lon
|
Bounds.BoundingBox ; Drawing boundaries in lat/lon
|
||||||
@@ -226,6 +230,7 @@ Module PBMap
|
|||||||
|
|
||||||
List Layers.Layer() ;
|
List Layers.Layer() ;
|
||||||
|
|
||||||
|
Angle.d
|
||||||
ZoomMin.i ; Min Zoom supported by server
|
ZoomMin.i ; Min Zoom supported by server
|
||||||
ZoomMax.i ; Max Zoom supported by server
|
ZoomMax.i ; Max Zoom supported by server
|
||||||
Zoom.i ; Current zoom
|
Zoom.i ; Current zoom
|
||||||
@@ -264,7 +269,7 @@ Module PBMap
|
|||||||
|
|
||||||
;Send debug infos to stdout (allowing mixed debug infos with curl or other libs)
|
;Send debug infos to stdout (allowing mixed debug infos with curl or other libs)
|
||||||
Procedure MyDebug(msg.s, DbgLevel = 0)
|
Procedure MyDebug(msg.s, DbgLevel = 0)
|
||||||
If Verbose And MyDebugLevel >= DbgLevel
|
If Verbose And DbgLevel >= MyDebugLevel
|
||||||
PrintN(msg)
|
PrintN(msg)
|
||||||
;Debug msg
|
;Debug msg
|
||||||
EndIf
|
EndIf
|
||||||
@@ -300,7 +305,7 @@ Module PBMap
|
|||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
Procedure.i CurlReceiveHTTPToMemory(URL$, ProxyURL$="", ProxyPort$="", ProxyUser$="", ProxyPassword$="")
|
Procedure.i CurlReceiveHTTPToMemory(URL$, ProxyURL$="", ProxyPort$="", ProxyUser$="", ProxyPassword$="")
|
||||||
Protected *Buffer, curl.i, Timeout.i, res.i
|
Protected *Buffer, curl.i, Timeout.i, res.i, respcode.l
|
||||||
If Len(URL$)
|
If Len(URL$)
|
||||||
curl = curl_easy_init()
|
curl = curl_easy_init()
|
||||||
If curl
|
If curl
|
||||||
@@ -311,6 +316,10 @@ Module PBMap
|
|||||||
curl_easy_setopt(curl, #CURLOPT_HEADER, 0)
|
curl_easy_setopt(curl, #CURLOPT_HEADER, 0)
|
||||||
curl_easy_setopt(curl, #CURLOPT_FOLLOWLOCATION, 1)
|
curl_easy_setopt(curl, #CURLOPT_FOLLOWLOCATION, 1)
|
||||||
curl_easy_setopt(curl, #CURLOPT_TIMEOUT, Timeout)
|
curl_easy_setopt(curl, #CURLOPT_TIMEOUT, Timeout)
|
||||||
|
If Verbose
|
||||||
|
curl_easy_setopt(curl, #CURLOPT_VERBOSE, 1)
|
||||||
|
EndIf
|
||||||
|
curl_easy_setopt(curl, #CURLOPT_FAILONERROR, 1)
|
||||||
If Len(ProxyURL$)
|
If Len(ProxyURL$)
|
||||||
;curl_easy_setopt(curl, #CURLOPT_HTTPPROXYTUNNEL, #True)
|
;curl_easy_setopt(curl, #CURLOPT_HTTPPROXYTUNNEL, #True)
|
||||||
If Len(ProxyPort$)
|
If Len(ProxyPort$)
|
||||||
@@ -340,7 +349,10 @@ Module PBMap
|
|||||||
EndIf
|
EndIf
|
||||||
;curl_easy_cleanup(curl) ;Was its original place but moved below as it seems more logical to me.
|
;curl_easy_cleanup(curl) ;Was its original place but moved below as it seems more logical to me.
|
||||||
Else
|
Else
|
||||||
MyDebug("CURL problem", 4)
|
curl_easy_getinfo(curl, #CURLINFO_HTTP_CODE, @respcode)
|
||||||
|
MyDebug("CURL : HTTP ERROR " + Str(respcode) , 8)
|
||||||
|
curl_easy_cleanup(curl)
|
||||||
|
ProcedureReturn #False
|
||||||
EndIf
|
EndIf
|
||||||
curl_easy_cleanup(curl)
|
curl_easy_cleanup(curl)
|
||||||
Else
|
Else
|
||||||
@@ -357,10 +369,10 @@ Module PBMap
|
|||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
Procedure.i CurlReceiveHTTPToFile(URL$, DestFileName$, ProxyURL$="", ProxyPort$="", ProxyUser$="", ProxyPassword$="")
|
Procedure.i CurlReceiveHTTPToFile(URL$, DestFileName$, ProxyURL$="", ProxyPort$="", ProxyUser$="", ProxyPassword$="")
|
||||||
Protected *Buffer, curl.i, Timeout.i, res.i
|
Protected *Buffer, curl.i, Timeout.i, res.i, respcode.l
|
||||||
Protected FileHandle.i
|
Protected FileHandle.i
|
||||||
MyDebug("CurlReceiveHTTPToFile from " + URL$ + " " + ProxyURL$ + " " + ProxyPort$ + " " + ProxyUser$, 4)
|
MyDebug("CurlReceiveHTTPToFile from " + URL$ + " " + ProxyURL$ + " " + ProxyPort$ + " " + ProxyUser$, 8)
|
||||||
MyDebug(" to file : " + DestFileName$, 4)
|
MyDebug(" to file : " + DestFileName$, 8)
|
||||||
FileHandle = CreateFile(#PB_Any, DestFileName$)
|
FileHandle = CreateFile(#PB_Any, DestFileName$)
|
||||||
If FileHandle And Len(URL$)
|
If FileHandle And Len(URL$)
|
||||||
curl = curl_easy_init()
|
curl = curl_easy_init()
|
||||||
@@ -371,21 +383,24 @@ Module PBMap
|
|||||||
curl_easy_setopt(curl, #CURLOPT_SSL_VERIFYHOST, 0)
|
curl_easy_setopt(curl, #CURLOPT_SSL_VERIFYHOST, 0)
|
||||||
curl_easy_setopt(curl, #CURLOPT_HEADER, 0)
|
curl_easy_setopt(curl, #CURLOPT_HEADER, 0)
|
||||||
curl_easy_setopt(curl, #CURLOPT_FOLLOWLOCATION, 1)
|
curl_easy_setopt(curl, #CURLOPT_FOLLOWLOCATION, 1)
|
||||||
curl_easy_setopt(curl, #CURLOPT_TIMEOUT, Timeout)
|
curl_easy_setopt(curl, #CURLOPT_TIMEOUT, Timeout)
|
||||||
curl_easy_setopt(curl, #CURLOPT_VERBOSE, 0)
|
If Verbose
|
||||||
|
curl_easy_setopt(curl, #CURLOPT_VERBOSE, 1)
|
||||||
|
EndIf
|
||||||
|
curl_easy_setopt(curl, #CURLOPT_FAILONERROR, 1)
|
||||||
;curl_easy_setopt(curl, #CURLOPT_CONNECTTIMEOUT, 60)
|
;curl_easy_setopt(curl, #CURLOPT_CONNECTTIMEOUT, 60)
|
||||||
If Len(ProxyURL$)
|
If Len(ProxyURL$)
|
||||||
;curl_easy_setopt(curl, #CURLOPT_HTTPPROXYTUNNEL, #True)
|
;curl_easy_setopt(curl, #CURLOPT_HTTPPROXYTUNNEL, #True)
|
||||||
If Len(ProxyPort$)
|
If Len(ProxyPort$)
|
||||||
ProxyURL$ + ":" + ProxyPort$
|
ProxyURL$ + ":" + ProxyPort$
|
||||||
EndIf
|
EndIf
|
||||||
MyDebug( ProxyURL$)
|
MyDebug(ProxyURL$, 8)
|
||||||
curl_easy_setopt(curl, #CURLOPT_PROXY, str2curl(ProxyURL$))
|
curl_easy_setopt(curl, #CURLOPT_PROXY, str2curl(ProxyURL$))
|
||||||
If Len(ProxyUser$)
|
If Len(ProxyUser$)
|
||||||
If Len(ProxyPassword$)
|
If Len(ProxyPassword$)
|
||||||
ProxyUser$ + ":" + ProxyPassword$
|
ProxyUser$ + ":" + ProxyPassword$
|
||||||
EndIf
|
EndIf
|
||||||
MyDebug( ProxyUser$)
|
MyDebug(ProxyUser$, 8)
|
||||||
curl_easy_setopt(curl, #CURLOPT_PROXYUSERPWD, str2curl(ProxyUser$))
|
curl_easy_setopt(curl, #CURLOPT_PROXYUSERPWD, str2curl(ProxyUser$))
|
||||||
EndIf
|
EndIf
|
||||||
EndIf
|
EndIf
|
||||||
@@ -393,11 +408,15 @@ Module PBMap
|
|||||||
curl_easy_setopt(curl, #CURLOPT_WRITEFUNCTION, @ReceiveHTTPWriteToFileFunction())
|
curl_easy_setopt(curl, #CURLOPT_WRITEFUNCTION, @ReceiveHTTPWriteToFileFunction())
|
||||||
res = curl_easy_perform(curl)
|
res = curl_easy_perform(curl)
|
||||||
If res <> #CURLE_OK
|
If res <> #CURLE_OK
|
||||||
MyDebug("CURL problem", 4)
|
curl_easy_getinfo(curl, #CURLINFO_HTTP_CODE, @respcode)
|
||||||
|
MyDebug("CURL : HTTP ERROR " + Str(respcode) , 8)
|
||||||
|
CloseFile(FileHandle)
|
||||||
|
curl_easy_cleanup(curl)
|
||||||
|
ProcedureReturn #False
|
||||||
EndIf
|
EndIf
|
||||||
curl_easy_cleanup(curl)
|
curl_easy_cleanup(curl)
|
||||||
Else
|
Else
|
||||||
MyDebug("Can't init CURL", 4)
|
MyDebug("Can't init CURL", 8)
|
||||||
EndIf
|
EndIf
|
||||||
CloseFile(FileHandle)
|
CloseFile(FileHandle)
|
||||||
ProcedureReturn FileSize(DestFileName$)
|
ProcedureReturn FileSize(DestFileName$)
|
||||||
@@ -746,8 +765,8 @@ Module PBMap
|
|||||||
Protected cx.d = PBMap\Drawing\CenterX
|
Protected cx.d = PBMap\Drawing\CenterX
|
||||||
Protected dpx.d = PBMap\PixelCoordinates\x
|
Protected dpx.d = PBMap\PixelCoordinates\x
|
||||||
Protected LatRad.d = Radian(*Location\Latitude)
|
Protected LatRad.d = Radian(*Location\Latitude)
|
||||||
Protected px = tilemax * (Mod( *Location\Longitude + 180.0, 360) / 360.0 )
|
Protected px.d = tilemax * (Mod( *Location\Longitude + 180.0, 360) / 360.0 )
|
||||||
Protected py = tilemax * ( 1.0 - Log(Tan(LatRad) + (1.0/Cos(LatRad))) / #PI ) / 2.0
|
Protected py.d = tilemax * ( 1.0 - Log(Tan(LatRad) + (1.0/Cos(LatRad))) / #PI ) / 2.0
|
||||||
;check the x boundaries of the map to adjust the position (coz of the longitude wrapping)
|
;check the x boundaries of the map to adjust the position (coz of the longitude wrapping)
|
||||||
If dpx - px >= tilemax / 2
|
If dpx - px >= tilemax / 2
|
||||||
;Debug "c1"
|
;Debug "c1"
|
||||||
@@ -783,6 +802,7 @@ Module PBMap
|
|||||||
ProcedureReturn (1000 * HaversineInKM(@*posA,@*posB));
|
ProcedureReturn (1000 * HaversineInKM(@*posA,@*posB));
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
|
; No more used, see LatLon2PixelRel
|
||||||
Procedure GetPixelCoordFromLocation(*Location.GeographicCoordinates, *Pixel.PixelCoordinates, Zoom) ; TODO to Optimize
|
Procedure GetPixelCoordFromLocation(*Location.GeographicCoordinates, *Pixel.PixelCoordinates, Zoom) ; TODO to Optimize
|
||||||
Protected mapWidth.l = Pow(2, Zoom + 8)
|
Protected mapWidth.l = Pow(2, Zoom + 8)
|
||||||
Protected mapHeight.l = Pow(2, Zoom + 8)
|
Protected mapHeight.l = Pow(2, Zoom + 8)
|
||||||
@@ -802,14 +822,21 @@ Module PBMap
|
|||||||
*Pixel\y=GadgetHeight(PBMap\Gadget)/2 - (y2-y1)
|
*Pixel\y=GadgetHeight(PBMap\Gadget)/2 - (y2-y1)
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
|
Procedure IsInDrawingPixelBoundaries(*Drawing.DrawingParameters, *Position.GeographicCoordinates)
|
||||||
|
Protected Pixel.PixelCoordinates
|
||||||
|
LatLon2Pixel(*Position, @Pixel, PBMap\Zoom)
|
||||||
|
If Pixel\x >= *Drawing\Bounds\BottomLeft\x And Pixel\y <= *Drawing\Bounds\BottomLeft\y And Pixel\x <= *Drawing\Bounds\TopRight\x And Pixel\y >= *Drawing\Bounds\TopRight\y
|
||||||
|
ProcedureReturn #True
|
||||||
|
Else
|
||||||
|
ProcedureReturn #False
|
||||||
|
EndIf
|
||||||
|
EndProcedure
|
||||||
|
|
||||||
|
;TODO : rotation fix
|
||||||
Procedure IsInDrawingBoundaries(*Drawing.DrawingParameters, *Position.GeographicCoordinates)
|
Procedure IsInDrawingBoundaries(*Drawing.DrawingParameters, *Position.GeographicCoordinates)
|
||||||
Protected Lat.d = *Position\Latitude, Lon.d = *Position\Longitude
|
Protected Lat.d = *Position\Latitude, Lon.d = *Position\Longitude
|
||||||
Protected LatNW.d = *Drawing\Bounds\NorthWest\Latitude, LonNW.d = *Drawing\Bounds\NorthWest\Longitude
|
Protected LatNW.d = *Drawing\Bounds\NorthWest\Latitude, LonNW.d = *Drawing\Bounds\NorthWest\Longitude
|
||||||
Protected LatSE.d = *Drawing\Bounds\SouthEast\Latitude, LonSE.d = *Drawing\Bounds\SouthEast\Longitude
|
Protected LatSE.d = *Drawing\Bounds\SouthEast\Latitude, LonSE.d = *Drawing\Bounds\SouthEast\Longitude
|
||||||
If LatSE > LatNW
|
|
||||||
Debug "WTF"
|
|
||||||
CallDebugger
|
|
||||||
EndIf
|
|
||||||
If Lat >= LatSE And Lat <= LatNW
|
If Lat >= LatSE And Lat <= LatNW
|
||||||
If *Drawing\Width >= 360
|
If *Drawing\Width >= 360
|
||||||
ProcedureReturn #True
|
ProcedureReturn #True
|
||||||
@@ -895,7 +922,7 @@ Module PBMap
|
|||||||
*Tile\RetryNb = 0
|
*Tile\RetryNb = 0
|
||||||
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(5000)
|
||||||
*Tile\RetryNb - 1
|
*Tile\RetryNb - 1
|
||||||
EndIf
|
EndIf
|
||||||
Until *Tile\RetryNb <= 0
|
Until *Tile\RetryNb <= 0
|
||||||
@@ -923,10 +950,9 @@ Module PBMap
|
|||||||
ProcedureReturn *timg
|
ProcedureReturn *timg
|
||||||
EndIf
|
EndIf
|
||||||
Else
|
Else
|
||||||
AddMapElement(PBMap\MemCache\Images(), key)
|
;PushMapPosition(PBMap\MemCache\Images())
|
||||||
PushMapPosition(PBMap\MemCache\Images())
|
|
||||||
;*** Cache management
|
;*** Cache management
|
||||||
; if cache size exceeds limit, try to delete the oldest tile used
|
; if cache size exceeds limit, try to delete the oldest tile used (first in the list)
|
||||||
Protected CacheSize = MapSize(PBMap\MemCache\Images()) * Pow(PBMap\TileSize, 2) * 4 ; Size of a tile = TileSize * TileSize * 4 bytes (RGBA)
|
Protected CacheSize = MapSize(PBMap\MemCache\Images()) * Pow(PBMap\TileSize, 2) * 4 ; Size of a tile = TileSize * TileSize * 4 bytes (RGBA)
|
||||||
Protected CacheLimit = PBMap\Options\MaxMemCache * 1024
|
Protected CacheLimit = PBMap\Options\MaxMemCache * 1024
|
||||||
MyDebug("Cache size : " + Str(CacheSize/1024) + " / CacheLimit : " + Str(CacheLimit/1024), 4)
|
MyDebug("Cache size : " + Str(CacheSize/1024) + " / CacheLimit : " + Str(CacheLimit/1024), 4)
|
||||||
@@ -942,9 +968,11 @@ Module PBMap
|
|||||||
CacheSize = MapSize(PBMap\MemCache\Images()) * Pow(PBMap\TileSize, 2) * 4 ; Size of a tile = TileSize * TileSize * 4 bytes (RGBA)
|
CacheSize = MapSize(PBMap\MemCache\Images()) * Pow(PBMap\TileSize, 2) * 4 ; Size of a tile = TileSize * TileSize * 4 bytes (RGBA)
|
||||||
EndIf
|
EndIf
|
||||||
Wend
|
Wend
|
||||||
PopMapPosition(PBMap\MemCache\Images())
|
LastElement(PBMap\MemCache\ImagesTimeStack())
|
||||||
|
;PopMapPosition(PBMap\MemCache\Images())
|
||||||
|
AddMapElement(PBMap\MemCache\Images(), key)
|
||||||
AddElement(PBMap\MemCache\ImagesTimeStack())
|
AddElement(PBMap\MemCache\ImagesTimeStack())
|
||||||
MoveElement(PBMap\MemCache\ImagesTimeStack(), #PB_List_Last)
|
;MoveElement(PBMap\MemCache\ImagesTimeStack(), #PB_List_Last)
|
||||||
PBMap\MemCache\ImagesTimeStack()\MapKey = MapKey(PBMap\MemCache\Images())
|
PBMap\MemCache\ImagesTimeStack()\MapKey = MapKey(PBMap\MemCache\Images())
|
||||||
;***
|
;***
|
||||||
MyDebug("Key : " + key + " added in memory cache!", 3)
|
MyDebug("Key : " + key + " added in memory cache!", 3)
|
||||||
@@ -957,7 +985,7 @@ Module PBMap
|
|||||||
If img <> -1
|
If img <> -1
|
||||||
MyDebug("Key : " + key + " found on HDD", 3)
|
MyDebug("Key : " + key + " found on HDD", 3)
|
||||||
*timg\nImage = img
|
*timg\nImage = img
|
||||||
*timg\Alpha = 0
|
*timg\Alpha = 256
|
||||||
ProcedureReturn *timg
|
ProcedureReturn *timg
|
||||||
EndIf
|
EndIf
|
||||||
MyDebug("Key : " + key + " not found on HDD", 3)
|
MyDebug("Key : " + key + " not found on HDD", 3)
|
||||||
@@ -1028,13 +1056,14 @@ Module PBMap
|
|||||||
*timg = GetTile(key, URL, CacheFile)
|
*timg = GetTile(key, URL, CacheFile)
|
||||||
If *timg\nImage <> -1
|
If *timg\nImage <> -1
|
||||||
MovePathCursor(px, py)
|
MovePathCursor(px, py)
|
||||||
DrawVectorImage(ImageID(*timg\nImage), *timg\Alpha)
|
If *timg\Alpha <= 224
|
||||||
If *timg\Alpha < 224
|
DrawVectorImage(ImageID(*timg\nImage), *timg\Alpha)
|
||||||
*timg\Alpha = (*timg\Alpha + 32) & $FF
|
*timg\Alpha + 32
|
||||||
PBMap\Redraw = #True
|
PBMap\Redraw = #True
|
||||||
Else
|
Else
|
||||||
*timg\Alpha = 255
|
DrawVectorImage(ImageID(*timg\nImage), 255)
|
||||||
EndIf
|
*timg\Alpha = 256
|
||||||
|
EndIf
|
||||||
Else
|
Else
|
||||||
MovePathCursor(px, py)
|
MovePathCursor(px, py)
|
||||||
DrawVectorImage(ImageID(PBMap\ImgLoading), 255)
|
DrawVectorImage(ImageID(PBMap\ImgLoading), 255)
|
||||||
@@ -1151,7 +1180,7 @@ Module PBMap
|
|||||||
StrokePath(1)
|
StrokePath(1)
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
Procedure TrackPointer(x.i, y.i, dist.l)
|
Procedure DrawTrackPointer(x.d, y.d, dist.l)
|
||||||
Protected color.l
|
Protected color.l
|
||||||
color=RGBA(0, 0, 0, 255)
|
color=RGBA(0, 0, 0, 255)
|
||||||
MovePathCursor(x,y)
|
MovePathCursor(x,y)
|
||||||
@@ -1170,7 +1199,7 @@ Module PBMap
|
|||||||
DrawVectorText(Str(dist))
|
DrawVectorText(Str(dist))
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
Procedure TrackPointerFirst(x.i, y.i, dist.l)
|
Procedure DrawTrackPointerFirst(x.d, y.d, dist.l)
|
||||||
Protected color.l
|
Protected color.l
|
||||||
color=RGBA(0, 0, 0, 255)
|
color=RGBA(0, 0, 0, 255)
|
||||||
MovePathCursor(x,y)
|
MovePathCursor(x,y)
|
||||||
@@ -1231,7 +1260,7 @@ Module PBMap
|
|||||||
;Check visibility
|
;Check visibility
|
||||||
\Visible = #False
|
\Visible = #False
|
||||||
ForEach \Track()
|
ForEach \Track()
|
||||||
If IsInDrawingBoundaries(*Drawing, @PBMap\TracksList()\Track())
|
If IsInDrawingPixelBoundaries(*Drawing, @PBMap\TracksList()\Track())
|
||||||
\Visible = #True
|
\Visible = #True
|
||||||
Break
|
Break
|
||||||
EndIf
|
EndIf
|
||||||
@@ -1241,9 +1270,9 @@ Module PBMap
|
|||||||
ForEach \Track()
|
ForEach \Track()
|
||||||
LatLon2PixelRel(@PBMap\TracksList()\Track(), @Pixel, PBMap\Zoom)
|
LatLon2PixelRel(@PBMap\TracksList()\Track(), @Pixel, PBMap\Zoom)
|
||||||
If ListIndex(\Track()) = 0
|
If ListIndex(\Track()) = 0
|
||||||
MovePathCursor(Pixel\X, Pixel\Y)
|
MovePathCursor(Pixel\x, Pixel\y)
|
||||||
Else
|
Else
|
||||||
AddPathLine(Pixel\X, Pixel\Y)
|
AddPathLine(Pixel\x, Pixel\y)
|
||||||
EndIf
|
EndIf
|
||||||
Next
|
Next
|
||||||
; \BoundingBox\x = PathBoundsX()
|
; \BoundingBox\x = PathBoundsX()
|
||||||
@@ -1281,11 +1310,13 @@ 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)
|
||||||
|
RotateCoordinates(Pixel\x, Pixel\y, -PBMap\Angle)
|
||||||
If Int(km) = 0
|
If Int(km) = 0
|
||||||
TrackPointerFirst(Pixel\X , Pixel\Y, Int(km))
|
DrawTrackPointerFirst(Pixel\x , Pixel\y, Int(km))
|
||||||
Else
|
Else
|
||||||
TrackPointer(Pixel\X , Pixel\Y, Int(km))
|
DrawTrackPointer(Pixel\x , Pixel\y, Int(km))
|
||||||
EndIf
|
EndIf
|
||||||
|
RotateCoordinates(Pixel\x, Pixel\y, PBMap\Angle)
|
||||||
EndIf
|
EndIf
|
||||||
Next
|
Next
|
||||||
EndIf
|
EndIf
|
||||||
@@ -1465,15 +1496,15 @@ Module PBMap
|
|||||||
Procedure DrawMarkers(*Drawing.DrawingParameters)
|
Procedure DrawMarkers(*Drawing.DrawingParameters)
|
||||||
Protected Pixel.PixelCoordinates
|
Protected Pixel.PixelCoordinates
|
||||||
ForEach PBMap\Markers()
|
ForEach PBMap\Markers()
|
||||||
If IsInDrawingBoundaries(*Drawing, @PBMap\Markers()\GeographicCoordinates)
|
If IsInDrawingPixelBoundaries(*Drawing, @PBMap\Markers()\GeographicCoordinates)
|
||||||
LatLon2PixelRel(PBMap\Markers()\GeographicCoordinates, @Pixel, PBMap\Zoom)
|
LatLon2PixelRel(@PBMap\Markers()\GeographicCoordinates, @Pixel, PBMap\Zoom)
|
||||||
If Pixel\X >= 0 And Pixel\Y >= 0 And Pixel\X < GadgetWidth(PBMap\Gadget) And Pixel\Y < GadgetHeight(PBMap\Gadget) ; Only if visible ^_^
|
RotateCoordinates(Pixel\x, Pixel\y, -PBMap\Angle)
|
||||||
If PBMap\Markers()\CallBackPointer > 0
|
If PBMap\Markers()\CallBackPointer > 0
|
||||||
CallFunctionFast(PBMap\Markers()\CallBackPointer, Pixel\X, Pixel\Y, PBMap\Markers()\Focus, PBMap\Markers()\Selected)
|
CallFunctionFast(PBMap\Markers()\CallBackPointer, Pixel\x, Pixel\y, PBMap\Markers()\Focus, PBMap\Markers()\Selected)
|
||||||
Else
|
Else
|
||||||
DrawMarker(Pixel\X, Pixel\Y, ListIndex(PBMap\Markers()), @PBMap\Markers())
|
DrawMarker(Pixel\x, Pixel\y, ListIndex(PBMap\Markers()), @PBMap\Markers())
|
||||||
EndIf
|
EndIf
|
||||||
EndIf
|
RotateCoordinates(Pixel\x, Pixel\y, PBMap\Angle)
|
||||||
EndIf
|
EndIf
|
||||||
Next
|
Next
|
||||||
EndProcedure
|
EndProcedure
|
||||||
@@ -1513,6 +1544,7 @@ Module PBMap
|
|||||||
;-*** Main drawing
|
;-*** Main drawing
|
||||||
Procedure Drawing()
|
Procedure Drawing()
|
||||||
Protected *Drawing.DrawingParameters = @PBMap\Drawing
|
Protected *Drawing.DrawingParameters = @PBMap\Drawing
|
||||||
|
Protected PixelCenter.PixelCoordinates
|
||||||
Protected Px.d, Py.d,a, ts = PBMap\TileSize, nx, ny
|
Protected Px.d, Py.d,a, ts = PBMap\TileSize, nx, ny
|
||||||
Protected NW.Coordinates, SE.Coordinates
|
Protected NW.Coordinates, SE.Coordinates
|
||||||
PBMap\Dirty = #False
|
PBMap\Dirty = #False
|
||||||
@@ -1523,25 +1555,47 @@ Module PBMap
|
|||||||
*Drawing\GeographicCoordinates\Latitude = PBMap\GeographicCoordinates\Latitude
|
*Drawing\GeographicCoordinates\Latitude = PBMap\GeographicCoordinates\Latitude
|
||||||
*Drawing\GeographicCoordinates\Longitude = PBMap\GeographicCoordinates\Longitude
|
*Drawing\GeographicCoordinates\Longitude = PBMap\GeographicCoordinates\Longitude
|
||||||
LatLon2TileXY(*Drawing\GeographicCoordinates, *Drawing\TileCoordinates, PBMap\Zoom)
|
LatLon2TileXY(*Drawing\GeographicCoordinates, *Drawing\TileCoordinates, PBMap\Zoom)
|
||||||
|
LatLon2Pixel(*Drawing\GeographicCoordinates, @PixelCenter, PBMap\Zoom)
|
||||||
; Pixel shift, aka position in the tile
|
; Pixel shift, aka position in the tile
|
||||||
Px = *Drawing\TileCoordinates\x
|
Px = *Drawing\TileCoordinates\x
|
||||||
Py = *Drawing\TileCoordinates\y
|
Py = *Drawing\TileCoordinates\y
|
||||||
*Drawing\DeltaX = Px * ts - (Int(Px) * ts) ;Don't forget the Int() !
|
*Drawing\DeltaX = Px * ts - (Int(Px) * ts) ;Don't forget the Int() !
|
||||||
*Drawing\DeltaY = Py * ts - (Int(Py) * ts)
|
*Drawing\DeltaY = Py * ts - (Int(Py) * ts)
|
||||||
;Drawing boundaries
|
;Drawing boundaries
|
||||||
nx = *Drawing\CenterX / ts ;How many tiles around the point
|
; nx = *Drawing\CenterX / ts ;How many tiles around the point
|
||||||
ny = *Drawing\CenterY / ts
|
; ny = *Drawing\CenterY / ts
|
||||||
NW\x = Px - nx - 1
|
; NW\x = Px - nx - 1
|
||||||
NW\y = Py - ny - 1
|
; NW\y = Py - ny - 1
|
||||||
SE\x = Px + nx + 2
|
; SE\x = Px + nx + 2
|
||||||
SE\y = Py + ny + 2
|
; SE\y = Py + ny + 2
|
||||||
TileXY2LatLon(@NW, *Drawing\Bounds\NorthWest, PBMap\Zoom)
|
; TileXY2LatLon(@NW, *Drawing\Bounds\NorthWest, PBMap\Zoom)
|
||||||
TileXY2LatLon(@SE, *Drawing\Bounds\SouthEast, PBMap\Zoom)
|
; TileXY2LatLon(@SE, *Drawing\Bounds\SouthEast, PBMap\Zoom)
|
||||||
*Drawing\Width = (SE\x / Pow(2, PBMap\Zoom) * 360.0) - (NW\x / Pow(2, PBMap\Zoom) * 360.0) ;Calculus without clipping
|
;TODO : rotation fix
|
||||||
*Drawing\Height = *Drawing\Bounds\NorthWest\Latitude - *Drawing\Bounds\SouthEast\Latitude
|
nx = PixelCenter\x - *Drawing\CenterX
|
||||||
|
ny = PixelCenter\y + *Drawing\CenterY
|
||||||
|
StartVectorDrawing(CanvasVectorOutput(PBMap\Gadget))
|
||||||
|
RotateCoordinates(PixelCenter\x, PixelCenter\y, PBMap\Angle)
|
||||||
|
*Drawing\Bounds\BottomLeft\x = ConvertCoordinateX(nx, ny, #PB_Coordinate_Device, #PB_Coordinate_User)
|
||||||
|
*Drawing\Bounds\BottomLeft\y = ConvertCoordinateY(nx, ny, #PB_Coordinate_Device, #PB_Coordinate_User)
|
||||||
|
nx + GadgetWidth(PBMap\Gadget)
|
||||||
|
ny - GadgetHeight(PBMap\Gadget)
|
||||||
|
*Drawing\Bounds\TopRight\x = ConvertCoordinateX(nx, ny, #PB_Coordinate_Device, #PB_Coordinate_User)
|
||||||
|
*Drawing\Bounds\TopRight\y = ConvertCoordinateY(nx, ny, #PB_Coordinate_Device, #PB_Coordinate_User)
|
||||||
|
StopVectorDrawing()
|
||||||
|
Pixel2LatLon(*Drawing\Bounds\BottomLeft, *Drawing\Bounds\SouthEast, PBMap\Zoom)
|
||||||
|
Pixel2LatLon(*Drawing\Bounds\TopRight, *Drawing\Bounds\NorthWest, PBMap\Zoom)
|
||||||
|
; Debug *Drawing\Bounds\NorthWest\Latitude
|
||||||
|
; Debug *Drawing\Bounds\NorthWest\Longitude
|
||||||
|
; Debug *Drawing\Bounds\SouthEast\Latitude
|
||||||
|
; Debug *Drawing\Bounds\SouthEast\Longitude
|
||||||
|
;*Drawing\Width = (SE\x / Pow(2, PBMap\Zoom) * 360.0) - (NW\x / Pow(2, PBMap\Zoom) * 360.0) ;Calculus without clipping
|
||||||
|
;*Drawing\Height = *Drawing\Bounds\NorthWest\Latitude - *Drawing\Bounds\SouthEast\Latitude
|
||||||
;***
|
;***
|
||||||
; Main drawing stuff
|
; Main drawing stuff
|
||||||
StartVectorDrawing(CanvasVectorOutput(PBMap\Gadget))
|
StartVectorDrawing(CanvasVectorOutput(PBMap\Gadget))
|
||||||
|
;Main rotation
|
||||||
|
RotateCoordinates(*Drawing\CenterX, *Drawing\CenterY, PBMap\Angle)
|
||||||
|
;Clearscreen
|
||||||
VectorSourceColor(RGBA(150, 150, 150, 255))
|
VectorSourceColor(RGBA(150, 150, 150, 255))
|
||||||
FillVectorOutput()
|
FillVectorOutput()
|
||||||
;TODO add in layers of tiles ;this way we can cache them as 0 base 1.n layers
|
;TODO add in layers of tiles ;this way we can cache them as 0 base 1.n layers
|
||||||
@@ -1549,21 +1603,22 @@ Module PBMap
|
|||||||
ForEach PBMap\Layers()
|
ForEach PBMap\Layers()
|
||||||
DrawTiles(*Drawing, ListIndex(PBMap\Layers()))
|
DrawTiles(*Drawing, ListIndex(PBMap\Layers()))
|
||||||
Next
|
Next
|
||||||
|
If PBMap\Options\ShowDegrees And PBMap\Zoom > 2
|
||||||
|
DrawDegrees(*Drawing, 192)
|
||||||
|
EndIf
|
||||||
If PBMap\Options\ShowTrack
|
If PBMap\Options\ShowTrack
|
||||||
DrawTracks(*Drawing)
|
DrawTracks(*Drawing)
|
||||||
EndIf
|
EndIf
|
||||||
If PBMap\Options\ShowMarkers
|
If PBMap\Options\ShowMarkers
|
||||||
DrawMarkers(*Drawing)
|
DrawMarkers(*Drawing)
|
||||||
EndIf
|
EndIf
|
||||||
|
ResetCoordinates()
|
||||||
If PBMap\Options\ShowPointer
|
If PBMap\Options\ShowPointer
|
||||||
DrawPointer(*Drawing)
|
DrawPointer(*Drawing)
|
||||||
EndIf
|
EndIf
|
||||||
If PBMap\Options\ShowDebugInfos
|
If PBMap\Options\ShowDebugInfos
|
||||||
DrawDebugInfos(*Drawing)
|
DrawDebugInfos(*Drawing)
|
||||||
EndIf
|
EndIf
|
||||||
If PBMap\Options\ShowDegrees And PBMap\Zoom > 2
|
|
||||||
DrawDegrees(*Drawing, 192)
|
|
||||||
EndIf
|
|
||||||
If PBMap\Options\ShowScale
|
If PBMap\Options\ShowScale
|
||||||
DrawScale(*Drawing, 10, GadgetHeight(PBMAP\Gadget) - 20, 192)
|
DrawScale(*Drawing, 10, GadgetHeight(PBMAP\Gadget) - 20, 192)
|
||||||
EndIf
|
EndIf
|
||||||
@@ -1708,6 +1763,16 @@ Module PBMap
|
|||||||
EndIf
|
EndIf
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
|
Procedure SetAngle(Angle.d, Mode = #PB_Absolute)
|
||||||
|
If Mode = #PB_Absolute
|
||||||
|
PBmap\Angle = Angle
|
||||||
|
Else
|
||||||
|
PBMap\Angle + Angle
|
||||||
|
PBMap\Angle = Mod(PBMap\Angle,360)
|
||||||
|
EndIf
|
||||||
|
PBMap\Redraw = #True
|
||||||
|
EndProcedure
|
||||||
|
|
||||||
Procedure SetCallBackLocation(CallBackLocation.i)
|
Procedure SetCallBackLocation(CallBackLocation.i)
|
||||||
PBMap\CallBackLocation = CallBackLocation
|
PBMap\CallBackLocation = CallBackLocation
|
||||||
EndProcedure
|
EndProcedure
|
||||||
@@ -1735,14 +1800,8 @@ Module PBMap
|
|||||||
ProcedureReturn PBMap\Mode
|
ProcedureReturn PBMap\Mode
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
;Zoom on x, y position relative to the canvas gadget
|
;Zoom on x, y pixel position from the center
|
||||||
Procedure SetZoomOnPosition(x, y, zoom)
|
Procedure ZoomOnPixel(x, y, zoom)
|
||||||
Protected MouseX.d, MouseY.d
|
|
||||||
Protected OldPx.d, OldPy.d, OldMx.d, OldMy.d, Px.d, Py.d
|
|
||||||
Protected CenterX = GadgetWidth(PBMap\Gadget) / 2
|
|
||||||
Protected CenterY = GadgetHeight(PBMap\Gadget) / 2
|
|
||||||
x - CenterX
|
|
||||||
y - CenterY
|
|
||||||
;*** First : Zoom
|
;*** First : Zoom
|
||||||
PBMap\Zoom + zoom
|
PBMap\Zoom + zoom
|
||||||
If PBMap\Zoom > PBMap\ZoomMax : PBMap\Zoom = PBMap\ZoomMax : ProcedureReturn : EndIf
|
If PBMap\Zoom > PBMap\ZoomMax : PBMap\Zoom = PBMap\ZoomMax : ProcedureReturn : EndIf
|
||||||
@@ -1764,7 +1823,16 @@ Module PBMap
|
|||||||
EndIf
|
EndIf
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
;Go to x, y position relative to the canvas gadget
|
;Zoom on x, y position relative to the canvas gadget
|
||||||
|
Procedure ZoomOnPixelRel(x, y, zoom)
|
||||||
|
Protected CenterX = GadgetWidth(PBMap\Gadget) / 2
|
||||||
|
Protected CenterY = GadgetHeight(PBMap\Gadget) / 2
|
||||||
|
x - CenterX
|
||||||
|
y - CenterY
|
||||||
|
ZoomOnPixel(x, y, zoom)
|
||||||
|
EndProcedure
|
||||||
|
|
||||||
|
;Go to x, y position relative to the canvas gadget left up
|
||||||
Procedure GotoPixelRel(x, y)
|
Procedure GotoPixelRel(x, y)
|
||||||
Protected CenterX = GadgetWidth(PBMap\Gadget) / 2
|
Protected CenterX = GadgetWidth(PBMap\Gadget) / 2
|
||||||
Protected CenterY = GadgetHeight(PBMap\Gadget) / 2
|
Protected CenterY = GadgetHeight(PBMap\Gadget) / 2
|
||||||
@@ -1782,6 +1850,19 @@ Module PBMap
|
|||||||
EndIf
|
EndIf
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
|
;Go to x, y position relative to the canvas gadget
|
||||||
|
Procedure GotoPixel(x, y)
|
||||||
|
PBMap\PixelCoordinates\x = x
|
||||||
|
PBMap\PixelCoordinates\y = y
|
||||||
|
Pixel2LatLon(@PBMap\PixelCoordinates, @PBMap\GeographicCoordinates, PBMap\Zoom)
|
||||||
|
; Start drawing
|
||||||
|
PBMap\Redraw = #True
|
||||||
|
; If CallBackLocation send Location to function
|
||||||
|
If PBMap\CallBackLocation > 0
|
||||||
|
CallFunctionFast(PBMap\CallBackLocation, @PBMap\GeographicCoordinates)
|
||||||
|
EndIf
|
||||||
|
EndProcedure
|
||||||
|
|
||||||
Procedure.d GetLatitude()
|
Procedure.d GetLatitude()
|
||||||
ProcedureReturn PBMap\GeographicCoordinates\Latitude
|
ProcedureReturn PBMap\GeographicCoordinates\Latitude
|
||||||
EndProcedure
|
EndProcedure
|
||||||
@@ -1791,9 +1872,11 @@ Module PBMap
|
|||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
Procedure.i GetZoom()
|
Procedure.i GetZoom()
|
||||||
Protected Value.d
|
ProcedureReturn PBMap\Zoom
|
||||||
Value = PBMap\Zoom
|
EndProcedure
|
||||||
ProcedureReturn Value
|
|
||||||
|
Procedure.d GetAngle()
|
||||||
|
ProcedureReturn PBMap\Angle
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
Procedure NominatimGeoLocationQuery(Address.s, *ReturnPosition.GeographicCoordinates = 0)
|
Procedure NominatimGeoLocationQuery(Address.s, *ReturnPosition.GeographicCoordinates = 0)
|
||||||
@@ -1834,13 +1917,23 @@ Module PBMap
|
|||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
Procedure CanvasEvents()
|
Procedure CanvasEvents()
|
||||||
Protected MouseX.i, MouseY.i
|
Protected CanvasMouseX.d, CanvasMouseY.d, MouseX.d, MouseY.d
|
||||||
Protected MarkerCoords.PixelCoordinates, *Tile.Tile, MapWidth = Pow(2, PBMap\Zoom) * PBMap\TileSize
|
Protected MarkerCoords.PixelCoordinates, *Tile.Tile, MapWidth = Pow(2, PBMap\Zoom) * PBMap\TileSize
|
||||||
Protected key.s, Touch.i
|
Protected key.s, Touch.i
|
||||||
Protected Pixel.PixelCoordinates
|
Protected Pixel.PixelCoordinates
|
||||||
Static CtrlKey
|
Static CtrlKey
|
||||||
PBMap\Moving = #False
|
PBMap\Moving = #False
|
||||||
|
MouseX = GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_MouseX) - PBMap\Drawing\CenterX
|
||||||
|
MouseY = GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_MouseY) - PBMap\Drawing\CenterY
|
||||||
|
StartVectorDrawing(CanvasVectorOutput(PBMap\Gadget))
|
||||||
|
RotateCoordinates(0, 0, PBMap\Angle)
|
||||||
|
CanvasMouseX = ConvertCoordinateX(MouseX, MouseY, #PB_Coordinate_Device, #PB_Coordinate_User)
|
||||||
|
CanvasMouseY = ConvertCoordinateY(MouseX, MouseY, #PB_Coordinate_Device, #PB_Coordinate_User)
|
||||||
|
StopVectorDrawing()
|
||||||
Select EventType()
|
Select EventType()
|
||||||
|
Case #PB_EventType_Focus
|
||||||
|
PBMap\Drawing\CenterX = GadgetWidth(PBMap\Gadget) / 2
|
||||||
|
PBMap\Drawing\CenterY = GadgetHeight(PBMap\Gadget) / 2
|
||||||
Case #PB_EventType_KeyUp
|
Case #PB_EventType_KeyUp
|
||||||
Select GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_Key)
|
Select GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_Key)
|
||||||
Case #PB_Shortcut_Delete
|
Case #PB_Shortcut_Delete
|
||||||
@@ -1886,8 +1979,8 @@ Module PBMap
|
|||||||
EndIf
|
EndIf
|
||||||
Case #PB_EventType_LeftDoubleClick
|
Case #PB_EventType_LeftDoubleClick
|
||||||
LatLon2Pixel(@PBMap\GeographicCoordinates, @PBMap\PixelCoordinates, PBMap\Zoom)
|
LatLon2Pixel(@PBMap\GeographicCoordinates, @PBMap\PixelCoordinates, PBMap\Zoom)
|
||||||
MouseX = PBMap\PixelCoordinates\x - GadgetWidth(PBMap\Gadget) / 2 + GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_MouseX)
|
MouseX = PBMap\PixelCoordinates\x + CanvasMouseX
|
||||||
MouseY = PBMap\PixelCoordinates\y - GadgetHeight(PBMap\Gadget) / 2 + GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_MouseY)
|
MouseY = PBMap\PixelCoordinates\y + CanvasMouseY
|
||||||
;Clip MouseX to the map range (in X, the map is infinite)
|
;Clip MouseX to the map range (in X, the map is infinite)
|
||||||
MouseX = Mod(Mod(MouseX, MapWidth) + MapWidth, MapWidth)
|
MouseX = Mod(Mod(MouseX, MapWidth) + MapWidth, MapWidth)
|
||||||
Touch = #False
|
Touch = #False
|
||||||
@@ -1907,22 +2000,23 @@ Module PBMap
|
|||||||
EndIf
|
EndIf
|
||||||
Next
|
Next
|
||||||
If Not Touch
|
If Not Touch
|
||||||
GotoPixelRel(GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_MouseX), GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_MouseY))
|
GotoPixel(MouseX, MouseY)
|
||||||
EndIf
|
EndIf
|
||||||
Case #PB_EventType_MouseWheel
|
Case #PB_EventType_MouseWheel
|
||||||
If PBMap\Options\WheelMouseRelative
|
If PBMap\Options\WheelMouseRelative
|
||||||
;Relative zoom (centered on the mouse)
|
;Relative zoom (centered on the mouse)
|
||||||
SetZoomOnPosition(GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_MouseX), GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_MouseY), GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_WheelDelta))
|
ZoomOnPixel(CanvasMouseX, CanvasMouseY, GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_WheelDelta))
|
||||||
Else
|
Else
|
||||||
;Absolute zoom (centered on the center of the map)
|
;Absolute zoom (centered on the center of the map)
|
||||||
SetZoom(GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_WheelDelta), #PB_Relative)
|
SetZoom(GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_WheelDelta), #PB_Relative)
|
||||||
EndIf
|
EndIf
|
||||||
Case #PB_EventType_LeftButtonDown
|
Case #PB_EventType_LeftButtonDown
|
||||||
LatLon2Pixel(@PBMap\GeographicCoordinates, @PBMap\PixelCoordinates, PBMap\Zoom)
|
;LatLon2Pixel(@PBMap\GeographicCoordinates, @PBMap\PixelCoordinates, PBMap\Zoom)
|
||||||
MouseX = PBMap\PixelCoordinates\x - GadgetWidth(PBMap\Gadget) / 2 + GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_MouseX)
|
;Mem cursor Coord
|
||||||
MouseY = PBMap\PixelCoordinates\y - GadgetHeight(PBMap\Gadget) / 2 + GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_MouseY)
|
PBMap\MoveStartingPoint\x = CanvasMouseX
|
||||||
|
PBMap\MoveStartingPoint\y = CanvasMouseY
|
||||||
;Clip MouseX to the map range (in X, the map is infinite)
|
;Clip MouseX to the map range (in X, the map is infinite)
|
||||||
MouseX = Mod(Mod(MouseX, MapWidth) + MapWidth, MapWidth)
|
PBMap\MoveStartingPoint\x = Mod(Mod(PBMap\MoveStartingPoint\x, MapWidth) + MapWidth, MapWidth)
|
||||||
If PBMap\Mode = #MODE_DEFAULT Or PBMap\Mode = #MODE_SELECT
|
If PBMap\Mode = #MODE_DEFAULT Or PBMap\Mode = #MODE_SELECT
|
||||||
PBMap\EditMarker = #False
|
PBMap\EditMarker = #False
|
||||||
;Check if we select marker(s)
|
;Check if we select marker(s)
|
||||||
@@ -1947,14 +2041,14 @@ Module PBMap
|
|||||||
EndIf
|
EndIf
|
||||||
Next
|
Next
|
||||||
EndIf
|
EndIf
|
||||||
;Mem cursor Coord
|
|
||||||
PBMap\MoveStartingPoint\x = GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_MouseX)
|
|
||||||
PBMap\MoveStartingPoint\y = GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_MouseY)
|
|
||||||
Case #PB_EventType_MouseMove
|
Case #PB_EventType_MouseMove
|
||||||
PBMap\Moving = #True
|
PBMap\Moving = #True
|
||||||
|
; Drag
|
||||||
If PBMap\MoveStartingPoint\x <> - 1
|
If PBMap\MoveStartingPoint\x <> - 1
|
||||||
MouseX = GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_MouseX) - PBMap\MoveStartingPoint\x
|
MouseX = CanvasMouseX - PBMap\MoveStartingPoint\x
|
||||||
MouseY = GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_MouseY) - PBMap\MoveStartingPoint\y
|
MouseY = CanvasMouseY - PBMap\MoveStartingPoint\y
|
||||||
|
PBMap\MoveStartingPoint\x = CanvasMouseX
|
||||||
|
PBMap\MoveStartingPoint\y = CanvasMouseY
|
||||||
;Move selected markers
|
;Move selected markers
|
||||||
If PBMap\EditMarker And (PBMap\Mode = #MODE_DEFAULT Or PBMap\Mode = #MODE_SELECT)
|
If PBMap\EditMarker And (PBMap\Mode = #MODE_DEFAULT Or PBMap\Mode = #MODE_SELECT)
|
||||||
ForEach PBMap\Markers()
|
ForEach PBMap\Markers()
|
||||||
@@ -1979,12 +2073,11 @@ Module PBMap
|
|||||||
EndIf
|
EndIf
|
||||||
EndIf
|
EndIf
|
||||||
PBMap\Redraw = #True
|
PBMap\Redraw = #True
|
||||||
PBMap\MoveStartingPoint\x = GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_MouseX)
|
|
||||||
PBMap\MoveStartingPoint\y = GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_MouseY)
|
|
||||||
Else
|
Else
|
||||||
|
; Touch test
|
||||||
LatLon2Pixel(@PBMap\GeographicCoordinates, @PBMap\PixelCoordinates, PBMap\Zoom)
|
LatLon2Pixel(@PBMap\GeographicCoordinates, @PBMap\PixelCoordinates, PBMap\Zoom)
|
||||||
MouseX = PBMap\PixelCoordinates\x - GadgetWidth(PBMap\Gadget) / 2 + GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_MouseX)
|
MouseX = PBMap\PixelCoordinates\x + CanvasMouseX
|
||||||
MouseY = PBMap\PixelCoordinates\y - GadgetHeight(PBMap\Gadget) / 2 + GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_MouseY)
|
MouseY = PBMap\PixelCoordinates\y + CanvasMouseY
|
||||||
;Clip MouseX to the map range (in X, the map is infinite)
|
;Clip MouseX to the map range (in X, the map is infinite)
|
||||||
MouseX = Mod(Mod(MouseX, MapWidth) + MapWidth, MapWidth)
|
MouseX = Mod(Mod(MouseX, MapWidth) + MapWidth, MapWidth)
|
||||||
If PBMap\Mode = #MODE_DEFAULT Or PBMap\Mode = #MODE_SELECT Or PBMap\Mode = #MODE_EDIT
|
If PBMap\Mode = #MODE_DEFAULT Or PBMap\Mode = #MODE_SELECT Or PBMap\Mode = #MODE_EDIT
|
||||||
@@ -1993,10 +2086,11 @@ Module PBMap
|
|||||||
LatLon2Pixel(@PBMap\Markers()\GeographicCoordinates, @MarkerCoords, PBMap\Zoom)
|
LatLon2Pixel(@PBMap\Markers()\GeographicCoordinates, @MarkerCoords, PBMap\Zoom)
|
||||||
If Distance(MarkerCoords\x, MarkerCoords\y, MouseX, MouseY) < 8
|
If Distance(MarkerCoords\x, MarkerCoords\y, MouseX, MouseY) < 8
|
||||||
PBMap\Markers()\Focus = #True
|
PBMap\Markers()\Focus = #True
|
||||||
Else
|
PBMap\Redraw = #True
|
||||||
|
ElseIf PBMap\Markers()\Focus
|
||||||
;If CtrlKey = #False
|
;If CtrlKey = #False
|
||||||
PBMap\Markers()\Focus = #False
|
PBMap\Markers()\Focus = #False
|
||||||
;EndIf
|
PBMap\Redraw = #True
|
||||||
EndIf
|
EndIf
|
||||||
Next
|
Next
|
||||||
;Check if mouse touch tracks
|
;Check if mouse touch tracks
|
||||||
@@ -2007,19 +2101,22 @@ Module PBMap
|
|||||||
If ListSize(\Track()) > 0
|
If ListSize(\Track()) > 0
|
||||||
If \Visible
|
If \Visible
|
||||||
StartVectorDrawing(CanvasVectorOutput(PBMap\Gadget))
|
StartVectorDrawing(CanvasVectorOutput(PBMap\Gadget))
|
||||||
;Draw tracks
|
RotateCoordinates(PBMap\Drawing\CenterX, PBMap\Drawing\CenterY, PBMap\Angle)
|
||||||
|
;Simulate tracks drawing
|
||||||
ForEach \Track()
|
ForEach \Track()
|
||||||
LatLon2PixelRel(@PBMap\TracksList()\Track(), @Pixel, PBMap\Zoom)
|
LatLon2Pixel(@PBMap\TracksList()\Track(), @Pixel, PBMap\Zoom)
|
||||||
If ListIndex(\Track()) = 0
|
If ListIndex(\Track()) = 0
|
||||||
MovePathCursor(Pixel\X, Pixel\Y)
|
MovePathCursor(Pixel\x, Pixel\y)
|
||||||
Else
|
Else
|
||||||
AddPathLine(Pixel\X, Pixel\Y)
|
AddPathLine(Pixel\x, Pixel\y)
|
||||||
EndIf
|
EndIf
|
||||||
Next
|
Next
|
||||||
If IsInsideStroke(GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_MouseX), GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_MouseY), \StrokeWidth)
|
If IsInsideStroke(MouseX, MouseY, \StrokeWidth)
|
||||||
\Focus = #True
|
\Focus = #True
|
||||||
Else
|
PBMap\Redraw = #True
|
||||||
|
ElseIf \Focus
|
||||||
\Focus = #False
|
\Focus = #False
|
||||||
|
PBMap\Redraw = #True
|
||||||
EndIf
|
EndIf
|
||||||
StopVectorDrawing()
|
StopVectorDrawing()
|
||||||
EndIf
|
EndIf
|
||||||
@@ -2027,9 +2124,7 @@ Module PBMap
|
|||||||
Next
|
Next
|
||||||
EndIf
|
EndIf
|
||||||
EndWith
|
EndWith
|
||||||
|
|
||||||
EndIf
|
EndIf
|
||||||
PBMap\Redraw = #True
|
|
||||||
EndIf
|
EndIf
|
||||||
Case #PB_EventType_LeftButtonUp
|
Case #PB_EventType_LeftButtonUp
|
||||||
PBMap\MoveStartingPoint\x = - 1
|
PBMap\MoveStartingPoint\x = - 1
|
||||||
@@ -2066,6 +2161,8 @@ Module PBMap
|
|||||||
BindGadgetEvent(PBMap\Gadget, @CanvasEvents())
|
BindGadgetEvent(PBMap\Gadget, @CanvasEvents())
|
||||||
AddWindowTimer(PBMap\Window, PBMap\Timer, PBMap\Options\TimerInterval)
|
AddWindowTimer(PBMap\Window, PBMap\Timer, PBMap\Options\TimerInterval)
|
||||||
BindEvent(#PB_Event_Timer, @TimerEvents())
|
BindEvent(#PB_Event_Timer, @TimerEvents())
|
||||||
|
PBMap\Drawing\CenterX = GadgetWidth(PBMap\Gadget) / 2
|
||||||
|
PBMap\Drawing\CenterX = GadgetHeight(PBMap\Gadget) / 2
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
; Creates a canvas and attach our map
|
; Creates a canvas and attach our map
|
||||||
@@ -2116,6 +2213,8 @@ CompilerIf #PB_Compiler_IsMainFile
|
|||||||
#Gdt_Right
|
#Gdt_Right
|
||||||
#Gdt_Up
|
#Gdt_Up
|
||||||
#Gdt_Down
|
#Gdt_Down
|
||||||
|
#Gdt_RotateLeft
|
||||||
|
#Gdt_RotateRight
|
||||||
#Button_4
|
#Button_4
|
||||||
#Button_5
|
#Button_5
|
||||||
#Combo_0
|
#Combo_0
|
||||||
@@ -2135,6 +2234,12 @@ CompilerIf #PB_Compiler_IsMainFile
|
|||||||
#StringGeoLocationQuery
|
#StringGeoLocationQuery
|
||||||
EndEnumeration
|
EndEnumeration
|
||||||
|
|
||||||
|
;Menu events
|
||||||
|
Enumeration
|
||||||
|
#MenuEventLonLatStringEnter
|
||||||
|
#MenuEventGeoLocationStringEnter
|
||||||
|
EndEnumeration
|
||||||
|
|
||||||
Structure Location
|
Structure Location
|
||||||
Longitude.d
|
Longitude.d
|
||||||
Latitude.d
|
Latitude.d
|
||||||
@@ -2177,6 +2282,8 @@ CompilerIf #PB_Compiler_IsMainFile
|
|||||||
ResizeGadget(#Text_1,WindowWidth(#Window_0)-170,#PB_Ignore,#PB_Ignore,#PB_Ignore)
|
ResizeGadget(#Text_1,WindowWidth(#Window_0)-170,#PB_Ignore,#PB_Ignore,#PB_Ignore)
|
||||||
ResizeGadget(#Gdt_Left, WindowWidth(#Window_0) - 150 ,#PB_Ignore,#PB_Ignore,#PB_Ignore)
|
ResizeGadget(#Gdt_Left, WindowWidth(#Window_0) - 150 ,#PB_Ignore,#PB_Ignore,#PB_Ignore)
|
||||||
ResizeGadget(#Gdt_Right,WindowWidth(#Window_0) - 90 ,#PB_Ignore,#PB_Ignore,#PB_Ignore)
|
ResizeGadget(#Gdt_Right,WindowWidth(#Window_0) - 90 ,#PB_Ignore,#PB_Ignore,#PB_Ignore)
|
||||||
|
ResizeGadget(#Gdt_RotateLeft, WindowWidth(#Window_0) - 150 ,#PB_Ignore,#PB_Ignore,#PB_Ignore)
|
||||||
|
ResizeGadget(#Gdt_RotateRight,WindowWidth(#Window_0) - 90 ,#PB_Ignore,#PB_Ignore,#PB_Ignore)
|
||||||
ResizeGadget(#Gdt_Up, WindowWidth(#Window_0) - 120 ,#PB_Ignore,#PB_Ignore,#PB_Ignore)
|
ResizeGadget(#Gdt_Up, WindowWidth(#Window_0) - 120 ,#PB_Ignore,#PB_Ignore,#PB_Ignore)
|
||||||
ResizeGadget(#Gdt_Down, WindowWidth(#Window_0) - 120 ,#PB_Ignore,#PB_Ignore,#PB_Ignore)
|
ResizeGadget(#Gdt_Down, WindowWidth(#Window_0) - 120 ,#PB_Ignore,#PB_Ignore,#PB_Ignore)
|
||||||
ResizeGadget(#Text_2,WindowWidth(#Window_0)-170,#PB_Ignore,#PB_Ignore,#PB_Ignore)
|
ResizeGadget(#Text_2,WindowWidth(#Window_0)-170,#PB_Ignore,#PB_Ignore,#PB_Ignore)
|
||||||
@@ -2201,8 +2308,11 @@ CompilerIf #PB_Compiler_IsMainFile
|
|||||||
|
|
||||||
LoadFont(0, "Arial", 12)
|
LoadFont(0, "Arial", 12)
|
||||||
LoadFont(1, "Arial", 12, #PB_Font_Bold)
|
LoadFont(1, "Arial", 12, #PB_Font_Bold)
|
||||||
|
LoadFont(2, "Arial", 8)
|
||||||
|
|
||||||
TextGadget(#Text_1, 530, 50, 60, 15, "Movements")
|
TextGadget(#Text_1, 530, 50, 60, 15, "Movements")
|
||||||
|
ButtonGadget(#Gdt_RotateLeft, 550, 070, 30, 30, "LRot") : SetGadgetFont(#Gdt_RotateLeft, FontID(2))
|
||||||
|
ButtonGadget(#Gdt_RotateRight, 610, 070, 30, 30, "RRot") : SetGadgetFont(#Gdt_RotateRight, FontID(2))
|
||||||
ButtonGadget(#Gdt_Left, 550, 100, 30, 30, Chr($25C4)) : SetGadgetFont(#Gdt_Left, FontID(0))
|
ButtonGadget(#Gdt_Left, 550, 100, 30, 30, Chr($25C4)) : SetGadgetFont(#Gdt_Left, FontID(0))
|
||||||
ButtonGadget(#Gdt_Right, 610, 100, 30, 30, Chr($25BA)) : SetGadgetFont(#Gdt_Right, FontID(0))
|
ButtonGadget(#Gdt_Right, 610, 100, 30, 30, Chr($25BA)) : SetGadgetFont(#Gdt_Right, FontID(0))
|
||||||
ButtonGadget(#Gdt_Up, 580, 070, 30, 30, Chr($25B2)) : SetGadgetFont(#Gdt_Up, FontID(0))
|
ButtonGadget(#Gdt_Up, 580, 070, 30, 30, Chr($25B2)) : SetGadgetFont(#Gdt_Up, FontID(0))
|
||||||
@@ -2222,7 +2332,7 @@ CompilerIf #PB_Compiler_IsMainFile
|
|||||||
TextGadget(#TextGeoLocationQuery, 530, 435, 150, 15, "Enter an address")
|
TextGadget(#TextGeoLocationQuery, 530, 435, 150, 15, "Enter an address")
|
||||||
StringGadget(#StringGeoLocationQuery, 530, 450, 150, 20, "")
|
StringGadget(#StringGeoLocationQuery, 530, 450, 150, 20, "")
|
||||||
SetActiveGadget(#StringGeoLocationQuery)
|
SetActiveGadget(#StringGeoLocationQuery)
|
||||||
AddKeyboardShortcut(#Window_0, #PB_Shortcut_Return, 1)
|
AddKeyboardShortcut(#Window_0, #PB_Shortcut_Return, #MenuEventGeoLocationStringEnter)
|
||||||
;*** TODO : code to remove when the SetActiveGadget(-1) will be fixed
|
;*** TODO : code to remove when the SetActiveGadget(-1) will be fixed
|
||||||
CompilerIf #PB_Compiler_OS = #PB_OS_Linux
|
CompilerIf #PB_Compiler_OS = #PB_OS_Linux
|
||||||
Define Dummy = ButtonGadget(#PB_Any, 0, 0, 1, 1, "Dummy")
|
Define Dummy = ButtonGadget(#PB_Any, 0, 0, 1, 1, "Dummy")
|
||||||
@@ -2230,6 +2340,7 @@ CompilerIf #PB_Compiler_IsMainFile
|
|||||||
CompilerElse
|
CompilerElse
|
||||||
Define Dummy = -1
|
Define Dummy = -1
|
||||||
CompilerEndIf
|
CompilerEndIf
|
||||||
|
;***
|
||||||
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
|
||||||
@@ -2265,6 +2376,12 @@ CompilerIf #PB_Compiler_IsMainFile
|
|||||||
PBMap::SetLocation(0, 10* -360 / Pow(2, PBMap::GetZoom() + 8), 0, #PB_Relative)
|
PBMap::SetLocation(0, 10* -360 / Pow(2, PBMap::GetZoom() + 8), 0, #PB_Relative)
|
||||||
Case #Gdt_Right
|
Case #Gdt_Right
|
||||||
PBMap::SetLocation(0, 10* 360 / Pow(2, PBMap::GetZoom() + 8), 0, #PB_Relative)
|
PBMap::SetLocation(0, 10* 360 / Pow(2, PBMap::GetZoom() + 8), 0, #PB_Relative)
|
||||||
|
Case #Gdt_RotateLeft
|
||||||
|
PBMAP::SetAngle(-5,#PB_Relative)
|
||||||
|
PBMap::Refresh()
|
||||||
|
Case #Gdt_RotateRight
|
||||||
|
PBMAP::SetAngle(5,#PB_Relative)
|
||||||
|
PBMap::Refresh()
|
||||||
Case #Button_4
|
Case #Button_4
|
||||||
PBMap::SetZoom(1)
|
PBMap::SetZoom(1)
|
||||||
Case #Button_5
|
Case #Button_5
|
||||||
@@ -2275,11 +2392,9 @@ CompilerIf #PB_Compiler_IsMainFile
|
|||||||
Case #StringLatitude, #StringLongitude
|
Case #StringLatitude, #StringLongitude
|
||||||
Select EventType()
|
Select EventType()
|
||||||
Case #PB_EventType_Focus
|
Case #PB_EventType_Focus
|
||||||
AddKeyboardShortcut(#Window_0, #PB_Shortcut_Return, 1)
|
AddKeyboardShortcut(#Window_0, #PB_Shortcut_Return, #MenuEventLonLatStringEnter)
|
||||||
Case #PB_EventType_LostFocus
|
Case #PB_EventType_LostFocus
|
||||||
RemoveKeyboardShortcut(#Window_0, #PB_Shortcut_Return)
|
RemoveKeyboardShortcut(#Window_0, #PB_Shortcut_Return)
|
||||||
PBMap::SetLocation(ValD(GetGadgetText(#StringLatitude)), ValD(GetGadgetText(#StringLongitude))) ; Change the PBMap coordinates
|
|
||||||
PBMap::Refresh()
|
|
||||||
EndSelect
|
EndSelect
|
||||||
Case #Gdt_AddMarker
|
Case #Gdt_AddMarker
|
||||||
PBMap::AddMarker(ValD(GetGadgetText(#StringLatitude)), ValD(GetGadgetText(#StringLongitude)), "", "Test", RGBA(Random(255), Random(255), Random(255), 255))
|
PBMap::AddMarker(ValD(GetGadgetText(#StringLatitude)), ValD(GetGadgetText(#StringLongitude)), "", "Test", RGBA(Random(255), Random(255), Random(255), 255))
|
||||||
@@ -2309,21 +2424,27 @@ CompilerIf #PB_Compiler_IsMainFile
|
|||||||
Case #StringGeoLocationQuery
|
Case #StringGeoLocationQuery
|
||||||
Select EventType()
|
Select EventType()
|
||||||
Case #PB_EventType_Focus
|
Case #PB_EventType_Focus
|
||||||
AddKeyboardShortcut(#Window_0, #PB_Shortcut_Return, 1)
|
AddKeyboardShortcut(#Window_0, #PB_Shortcut_Return, #MenuEventGeoLocationStringEnter)
|
||||||
Case #PB_EventType_LostFocus
|
Case #PB_EventType_LostFocus
|
||||||
RemoveKeyboardShortcut(#Window_0, #PB_Shortcut_Return)
|
RemoveKeyboardShortcut(#Window_0, #PB_Shortcut_Return)
|
||||||
PBMap::NominatimGeoLocationQuery(GetGadgetText(#StringGeoLocationQuery))
|
|
||||||
PBMap::Refresh()
|
|
||||||
EndSelect
|
EndSelect
|
||||||
EndSelect
|
EndSelect
|
||||||
Case #PB_Event_SizeWindow
|
Case #PB_Event_SizeWindow
|
||||||
ResizeAll()
|
ResizeAll()
|
||||||
Case #PB_Event_Menu
|
Case #PB_Event_Menu
|
||||||
|
;Receive "enter" key events
|
||||||
Select EventMenu()
|
Select EventMenu()
|
||||||
Case 1
|
Case #MenuEventGeoLocationStringEnter
|
||||||
|
If GetGadgetText(#StringGeoLocationQuery) <> ""
|
||||||
|
PBMap::NominatimGeoLocationQuery(GetGadgetText(#StringGeoLocationQuery))
|
||||||
|
PBMap::Refresh()
|
||||||
|
EndIf
|
||||||
;*** TODO : code to change when the SetActiveGadget(-1) will be fixed
|
;*** TODO : code to change when the SetActiveGadget(-1) will be fixed
|
||||||
SetActiveGadget(Dummy)
|
SetActiveGadget(Dummy)
|
||||||
;***
|
;***
|
||||||
|
Case #MenuEventLonLatStringEnter
|
||||||
|
PBMap::SetLocation(ValD(GetGadgetText(#StringLatitude)), ValD(GetGadgetText(#StringLongitude))) ; Change the PBMap coordinates
|
||||||
|
PBMap::Refresh()
|
||||||
EndSelect
|
EndSelect
|
||||||
EndSelect
|
EndSelect
|
||||||
Until Quit = #True
|
Until Quit = #True
|
||||||
@@ -2335,9 +2456,9 @@ CompilerEndIf
|
|||||||
|
|
||||||
|
|
||||||
; IDE Options = PureBasic 5.42 LTS (Windows - x64)
|
; IDE Options = PureBasic 5.42 LTS (Windows - x64)
|
||||||
; CursorPosition = 1015
|
; CursorPosition = 2430
|
||||||
; FirstLine = 1007
|
; FirstLine = 2401
|
||||||
; Folding = ----------------
|
; Folding = -----------------
|
||||||
; EnableUnicode
|
; EnableUnicode
|
||||||
; EnableThread
|
; EnableThread
|
||||||
; EnableXP
|
; EnableXP
|
Reference in New Issue
Block a user