Cleanup
This commit is contained in:
41
PBMap.pb
41
PBMap.pb
@@ -460,9 +460,7 @@ Module PBMap
|
|||||||
EndIf
|
EndIf
|
||||||
*Pixel\y = PBMap\Drawing\CenterY + (py - PBMap\PixelCoordinates\y)
|
*Pixel\y = PBMap\Drawing\CenterY + (py - PBMap\PixelCoordinates\y)
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; HaversineAlgorithm
|
; HaversineAlgorithm
|
||||||
; http://andrew.hedges.name/experiments/haversine/
|
; http://andrew.hedges.name/experiments/haversine/
|
||||||
Procedure.d HaversineInKM(*posA.GeographicCoordinates, *posB.GeographicCoordinates)
|
Procedure.d HaversineInKM(*posA.GeographicCoordinates, *posB.GeographicCoordinates)
|
||||||
@@ -485,26 +483,17 @@ Module PBMap
|
|||||||
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)
|
||||||
Protected x1.l,y1.l
|
Protected x1.l,y1.l
|
||||||
; get x value
|
|
||||||
x1 = (*Location\Longitude+180)*(mapWidth/360)
|
x1 = (*Location\Longitude+180)*(mapWidth/360)
|
||||||
; convert from degrees To radians
|
; convert from degrees To radians
|
||||||
Protected latRad.d = *Location\Latitude*#PI/180;
|
Protected latRad.d = *Location\Latitude*#PI/180;
|
||||||
Protected mercN.d = Log(Tan((#PI/4)+(latRad/2)));
|
Protected mercN.d = Log(Tan((#PI/4)+(latRad/2)));
|
||||||
y1 = (mapHeight/2)-(mapWidth*mercN/(2*#PI)) ;
|
y1 = (mapHeight/2)-(mapWidth*mercN/(2*#PI)) ;
|
||||||
; Debug "location"
|
|
||||||
; Debug x1
|
|
||||||
; Debug y1
|
|
||||||
Protected x2.l, y2.l
|
Protected x2.l, y2.l
|
||||||
; get x value
|
|
||||||
x2 = (PBMap\GeographicCoordinates\Longitude+180)*(mapWidth/360)
|
x2 = (PBMap\GeographicCoordinates\Longitude+180)*(mapWidth/360)
|
||||||
; convert from degrees To radians
|
; convert from degrees To radians
|
||||||
latRad = PBMap\GeographicCoordinates\Latitude*#PI/180;
|
latRad = PBMap\GeographicCoordinates\Latitude*#PI/180;
|
||||||
; get y value
|
|
||||||
mercN = Log(Tan((#PI/4)+(latRad/2)))
|
mercN = Log(Tan((#PI/4)+(latRad/2)))
|
||||||
y2 = (mapHeight/2)-(mapWidth*mercN/(2*#PI));
|
y2 = (mapHeight/2)-(mapWidth*mercN/(2*#PI));
|
||||||
; Debug "GeographicCoordinates"
|
|
||||||
; Debug x1
|
|
||||||
; Debug y1
|
|
||||||
*Pixel\x=GadgetWidth(PBMap\Gadget)/2 - (x2-x1)
|
*Pixel\x=GadgetWidth(PBMap\Gadget)/2 - (x2-x1)
|
||||||
*Pixel\y=GadgetHeight(PBMap\Gadget)/2 - (y2-y1)
|
*Pixel\y=GadgetHeight(PBMap\Gadget)/2 - (y2-y1)
|
||||||
EndProcedure
|
EndProcedure
|
||||||
@@ -538,11 +527,7 @@ Module PBMap
|
|||||||
Next
|
Next
|
||||||
EndIf
|
EndIf
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
; Procedure LoadErrorHandler()
|
|
||||||
; MessageRequester("Error", "")
|
|
||||||
; EndProcedure
|
|
||||||
|
|
||||||
Procedure.i GetTileFromHDD(CacheFile.s)
|
Procedure.i GetTileFromHDD(CacheFile.s)
|
||||||
Protected nImage.i
|
Protected nImage.i
|
||||||
If FileSize(CacheFile) > 0
|
If FileSize(CacheFile) > 0
|
||||||
@@ -579,16 +564,6 @@ Module PBMap
|
|||||||
If *Buffer
|
If *Buffer
|
||||||
nImage = CatchImage(#PB_Any, *Buffer, MemorySize(*Buffer))
|
nImage = CatchImage(#PB_Any, *Buffer, MemorySize(*Buffer))
|
||||||
If IsImage(nImage)
|
If IsImage(nImage)
|
||||||
; Debug "url: " + TileURL
|
|
||||||
; Debug "cache file: " + CacheFile
|
|
||||||
; timg = LoadImage(#PB_Any,CacheFile)
|
|
||||||
; If timg
|
|
||||||
; StartDrawing(ImageOutput(timg))
|
|
||||||
; DrawImage(ImageID(nimage))
|
|
||||||
; StopDrawing()
|
|
||||||
; SaveImage(timg, CacheFile, #PB_ImagePlugin_PNG)
|
|
||||||
; FreeImage(timg)
|
|
||||||
; Else
|
|
||||||
If SaveImage(nImage, CacheFile, #PB_ImagePlugin_PNG, 0, 32)
|
If SaveImage(nImage, CacheFile, #PB_ImagePlugin_PNG, 0, 32)
|
||||||
MyDebug("Loaded from web " + TileURL + " as CacheFile " + CacheFile, 3)
|
MyDebug("Loaded from web " + TileURL + " as CacheFile " + CacheFile, 3)
|
||||||
Else
|
Else
|
||||||
@@ -764,18 +739,15 @@ Module PBMap
|
|||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
Procedure DrawScale(*Drawing.DrawingParameters,x,y,alpha=80)
|
Procedure DrawScale(*Drawing.DrawingParameters,x,y,alpha=80)
|
||||||
;TODO Add Option and function to display Scale on Map
|
|
||||||
Protected sunit.s
|
Protected sunit.s
|
||||||
Protected Scale.d= 40075*Cos(Radian(PBMap\GeographicCoordinates\Latitude))/Pow(2,PBMap\Zoom) / 2
|
Protected Scale.d= 40075*Cos(Radian(PBMap\GeographicCoordinates\Latitude))/Pow(2,PBMap\Zoom) / 2
|
||||||
|
|
||||||
Select PBMap\Options\ScaleUnit
|
Select PBMap\Options\ScaleUnit
|
||||||
Case #SCALE_Nautical
|
Case #SCALE_Nautical
|
||||||
Scale * 0.539957
|
Scale * 0.539957
|
||||||
sunit = " Nm"
|
sunit = " Nm"
|
||||||
Case #SCALE_KM;
|
Case #SCALE_KM;
|
||||||
sunit = " Km"
|
sunit = " Km"
|
||||||
EndSelect
|
EndSelect
|
||||||
|
|
||||||
VectorFont(FontID(PBMap\Font), 10)
|
VectorFont(FontID(PBMap\Font), 10)
|
||||||
VectorSourceColor(RGBA(0, 0, 0,alpha))
|
VectorSourceColor(RGBA(0, 0, 0,alpha))
|
||||||
MovePathCursor(x,y)
|
MovePathCursor(x,y)
|
||||||
@@ -1333,8 +1305,6 @@ CompilerIf #PB_Compiler_IsMainFile
|
|||||||
EndStructure
|
EndStructure
|
||||||
|
|
||||||
Procedure UpdateLocation(*Location.Location)
|
Procedure UpdateLocation(*Location.Location)
|
||||||
; SetGadgetText(#String_0, StrD(0-(90-Mod((*Location\Latitude+90),180))))
|
|
||||||
; SetGadgetText(#String_1, StrD(0-(180-Mod((*Location\Longitude+180),360))))
|
|
||||||
SetGadgetText(#String_0, StrD(*Location\Latitude))
|
SetGadgetText(#String_0, StrD(*Location\Latitude))
|
||||||
SetGadgetText(#String_1, StrD(*Location\Longitude))
|
SetGadgetText(#String_1, StrD(*Location\Longitude))
|
||||||
ProcedureReturn 0
|
ProcedureReturn 0
|
||||||
@@ -1456,8 +1426,7 @@ CompilerIf #PB_Compiler_IsMainFile
|
|||||||
|
|
||||||
CompilerEndIf
|
CompilerEndIf
|
||||||
; IDE Options = PureBasic 5.50 (Windows - x64)
|
; IDE Options = PureBasic 5.50 (Windows - x64)
|
||||||
; CursorPosition = 310
|
; CursorPosition = 1411
|
||||||
; FirstLine = 291
|
|
||||||
; Folding = -----------
|
; Folding = -----------
|
||||||
; EnableThread
|
; EnableThread
|
||||||
; EnableXP
|
; EnableXP
|
||||||
|
Reference in New Issue
Block a user