Map move limit
This commit is contained in:
31
PBMap.pb
31
PBMap.pb
@@ -646,6 +646,12 @@ Module PBMap
|
|||||||
;Ensures the longitude to be in the range [-180;180[
|
;Ensures the longitude to be in the range [-180;180[
|
||||||
*Location\Longitude = Mod(Mod(*Coords\x / n * 360.0, 360.0) + 360.0, 360.0) - 180
|
*Location\Longitude = Mod(Mod(*Coords\x / n * 360.0, 360.0) + 360.0, 360.0) - 180
|
||||||
*Location\Latitude = Degree(ATan(SinH(#PI * (1.0 - 2.0 * *Coords\y / n))))
|
*Location\Latitude = Degree(ATan(SinH(#PI * (1.0 - 2.0 * *Coords\y / n))))
|
||||||
|
If *Location\Latitude <= -89
|
||||||
|
*Location\Latitude = -89
|
||||||
|
EndIf
|
||||||
|
If *Location\Latitude >= 89
|
||||||
|
*Location\Latitude = 89
|
||||||
|
EndIf
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
Procedure Pixel2LatLon(*Coords.PixelCoordinates, *Location.GeographicCoordinates, Zoom)
|
Procedure Pixel2LatLon(*Coords.PixelCoordinates, *Location.GeographicCoordinates, Zoom)
|
||||||
@@ -653,6 +659,12 @@ Module PBMap
|
|||||||
;Ensures the longitude to be in the range [-180;180[
|
;Ensures the longitude to be in the range [-180;180[
|
||||||
*Location\Longitude = Mod(Mod(*Coords\x / n * 360.0, 360.0) + 360.0, 360.0) - 180
|
*Location\Longitude = Mod(Mod(*Coords\x / n * 360.0, 360.0) + 360.0, 360.0) - 180
|
||||||
*Location\Latitude = Degree(ATan(SinH(#PI * (1.0 - 2.0 * *Coords\y / n))))
|
*Location\Latitude = Degree(ATan(SinH(#PI * (1.0 - 2.0 * *Coords\y / n))))
|
||||||
|
If *Location\Latitude <= -89
|
||||||
|
*Location\Latitude = -89
|
||||||
|
EndIf
|
||||||
|
If *Location\Latitude >= 89
|
||||||
|
*Location\Latitude = 89
|
||||||
|
EndIf
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
;Ensures the longitude to be in the range [-180;180[
|
;Ensures the longitude to be in the range [-180;180[
|
||||||
@@ -1028,10 +1040,10 @@ Module PBMap
|
|||||||
; *Drawing\Bounds\SouthEast\x = tx+nx+2
|
; *Drawing\Bounds\SouthEast\x = tx+nx+2
|
||||||
; *Drawing\Bounds\SouthEast\y = ty+ny+2
|
; *Drawing\Bounds\SouthEast\y = ty+ny+2
|
||||||
; Debug "------------------"
|
; Debug "------------------"
|
||||||
|
;TileXY2LatLon(*Drawing\Bounds\NorthWest, @Degrees1, PBMap\Zoom)
|
||||||
|
;TileXY2LatLon(*Drawing\Bounds\SouthEast, @Degrees2, PBMap\Zoom)
|
||||||
CopyStructure(*Drawing\Bounds\NorthWest, @Degrees1, GeographicCoordinates)
|
CopyStructure(*Drawing\Bounds\NorthWest, @Degrees1, GeographicCoordinates)
|
||||||
CopyStructure(*Drawing\Bounds\SouthEast, @Degrees2, GeographicCoordinates)
|
CopyStructure(*Drawing\Bounds\SouthEast, @Degrees2, GeographicCoordinates)
|
||||||
;TileXY2LatLon(*Drawing\Bounds\NorthWest, @Degrees1, PBMap\Zoom)
|
|
||||||
;TileXY2LatLon(*Drawing\Bounds\SouthEast, @Degrees2, PBMap\Zoom)
|
|
||||||
;ensure we stay positive for the drawing
|
;ensure we stay positive for the drawing
|
||||||
nx = Mod(Mod(Round(Degrees1\Longitude, #PB_Round_Down)-1, 360) + 360, 360)
|
nx = Mod(Mod(Round(Degrees1\Longitude, #PB_Round_Down)-1, 360) + 360, 360)
|
||||||
ny = Round(Degrees1\Latitude, #PB_Round_Up) +1
|
ny = Round(Degrees1\Latitude, #PB_Round_Up) +1
|
||||||
@@ -1398,7 +1410,7 @@ Module PBMap
|
|||||||
If PBMap\Options\ShowDebugInfos
|
If PBMap\Options\ShowDebugInfos
|
||||||
DrawDebugInfos(*Drawing)
|
DrawDebugInfos(*Drawing)
|
||||||
EndIf
|
EndIf
|
||||||
If PBMap\Options\ShowDegrees
|
If PBMap\Options\ShowDegrees And PBMap\Zoom > 2
|
||||||
DrawDegrees(*Drawing, 192)
|
DrawDegrees(*Drawing, 192)
|
||||||
EndIf
|
EndIf
|
||||||
If PBMap\Options\ShowScale
|
If PBMap\Options\ShowScale
|
||||||
@@ -1453,6 +1465,13 @@ Module PBMap
|
|||||||
PBMap\Zoom + Zoom
|
PBMap\Zoom + Zoom
|
||||||
EndIf
|
EndIf
|
||||||
EndSelect
|
EndSelect
|
||||||
|
PBMap\GeographicCoordinates\Longitude = ClipLongitude(PBMap\GeographicCoordinates\Longitude)
|
||||||
|
If PBMap\GeographicCoordinates\Latitude < -89
|
||||||
|
PBMap\GeographicCoordinates\Latitude = -89
|
||||||
|
EndIf
|
||||||
|
If PBMap\GeographicCoordinates\Latitude > 89
|
||||||
|
PBMap\GeographicCoordinates\Latitude = 89
|
||||||
|
EndIf
|
||||||
If PBMap\Zoom > PBMap\ZoomMax : PBMap\Zoom = PBMap\ZoomMax : EndIf
|
If PBMap\Zoom > PBMap\ZoomMax : PBMap\Zoom = PBMap\ZoomMax : EndIf
|
||||||
If PBMap\Zoom < PBMap\ZoomMin : PBMap\Zoom = PBMap\ZoomMin : EndIf
|
If PBMap\Zoom < PBMap\ZoomMin : PBMap\Zoom = PBMap\ZoomMin : EndIf
|
||||||
LatLon2TileXY(@PBMap\GeographicCoordinates, @PBMap\Drawing\TileCoordinates, PBMap\Zoom)
|
LatLon2TileXY(@PBMap\GeographicCoordinates, @PBMap\Drawing\TileCoordinates, PBMap\Zoom)
|
||||||
@@ -1974,7 +1993,7 @@ CompilerIf #PB_Compiler_IsMainFile
|
|||||||
;Our main gadget
|
;Our main gadget
|
||||||
PBMap::InitPBMap(#Window_0)
|
PBMap::InitPBMap(#Window_0)
|
||||||
PBMap::SetOption("ShowDegrees", "1")
|
PBMap::SetOption("ShowDegrees", "1")
|
||||||
PBMap::SetOption("ShowDebugInfos", "1")
|
PBMap::SetOption("ShowDebugInfos", "0")
|
||||||
PBMap::SetOption("ShowScale", "1")
|
PBMap::SetOption("ShowScale", "1")
|
||||||
PBMap::SetOption("ShowMarkersLegend", "1")
|
PBMap::SetOption("ShowMarkersLegend", "1")
|
||||||
PBMap::SetOption("ShowTrackKms", "1")
|
PBMap::SetOption("ShowTrackKms", "1")
|
||||||
@@ -2039,8 +2058,8 @@ CompilerIf #PB_Compiler_IsMainFile
|
|||||||
CompilerEndIf
|
CompilerEndIf
|
||||||
|
|
||||||
; IDE Options = PureBasic 5.50 (Windows - x64)
|
; IDE Options = PureBasic 5.50 (Windows - x64)
|
||||||
; CursorPosition = 55
|
; CursorPosition = 1467
|
||||||
; FirstLine = 34
|
; FirstLine = 1437
|
||||||
; Folding = --------------
|
; Folding = --------------
|
||||||
; EnableThread
|
; EnableThread
|
||||||
; EnableXP
|
; EnableXP
|
Reference in New Issue
Block a user