From a1f593c89bfc0d324918774f14c18dce40a471bb Mon Sep 17 00:00:00 2001 From: djes Date: Mon, 3 Oct 2016 16:48:14 +0200 Subject: [PATCH] Cleaning up tile structure --- PBMap.pb | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/PBMap.pb b/PBMap.pb index 1ee65be..0d925ae 100644 --- a/PBMap.pb +++ b/PBMap.pb @@ -99,16 +99,12 @@ Module PBMap ;- Tile Structure Structure Tile - Position.Coordinates - PBMapTileX.i - PBMapTileY.i - PBMapZoom.i nImage.i key.s + URL.s CacheFile.s GetImageThread.i RetryNb.i - ServerURL.s EndStructure Structure BoundingBox @@ -136,6 +132,7 @@ Module PBMap nImage.i *Tile.Tile TimeStackPosition.i + Alpha.i EndStructure Structure ImgMemCachKey @@ -891,9 +888,8 @@ Module PBMap Procedure GetImageThread(*Tile.Tile) Protected nImage.i = -1 - Protected TileURL.s = *Tile\ServerURL + Str(*Tile\PBMapZoom) + "/" + Str(*Tile\PBMapTileX) + "/" + Str(*Tile\PBMapTileY) + ".png" Repeat - nImage = GetTileFromWeb(TileURL, *Tile\CacheFile) + nImage = GetTileFromWeb(*Tile\URL, *Tile\CacheFile) If nImage <> -1 MyDebug("Image key : " + *Tile\key + " web image loaded", 3) *Tile\RetryNb = 0 @@ -909,7 +905,7 @@ Module PBMap EndProcedure ;-*** - Procedure.i GetTile(key.s, CacheFile.s, px.i, py.i, tilex.i, tiley.i, ServerURL.s) + Procedure.i GetTile(key.s, URL.s, CacheFile.s) ; Try to find the tile in memory cache. If not found, add it, try To load it from the ; HDD, or launch a loading thread, and try again on the next drawing loop. Protected timg = -1 @@ -967,14 +963,9 @@ Module PBMap With *NewTile PBMap\MemCache\Images()\Tile = *NewTile ;New tile parameters - \Position\x = px - \Position\y = py - \PBMapTileX = tilex - \PBMapTileY = tiley - \PBMapZoom = PBMap\Zoom \key = key + \URL = URL \CacheFile = CacheFile - \ServerURL = ServerURL \RetryNb = 5 \nImage = -1 MyDebug(" Creating get image thread nb " + Str(\GetImageThread) + " to get " + CacheFile, 3) @@ -993,7 +984,8 @@ Module PBMap Protected ty = Int(*Drawing\TileCoordinates\y) Protected nx = *Drawing\CenterX / PBMap\TileSize ;How many tiles around the point Protected ny = *Drawing\CenterY / PBMap\TileSize - Protected px, py, img, tilex,tiley, key.s, CacheFile.s + Protected px, py, img, tilex,tiley, key.s + Protected URL.s, CacheFile.s Protected tilemax = 1< -1 MovePathCursor(px, py) DrawVectorImage(ImageID(img), alpha) @@ -2218,7 +2211,7 @@ CompilerIf #PB_Compiler_IsMainFile AddKeyboardShortcut(#Window_0, #PB_Shortcut_Return, 1) ;*** TODO : code to remove when the SetActiveGadget(-1) will be fixed 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") HideGadget(Dummy, 1) CompilerElse Define Dummy = -1 @@ -2329,8 +2322,8 @@ CompilerIf #PB_Compiler_IsMainFile CompilerEndIf ; IDE Options = PureBasic 5.50 (Windows - x64) -; CursorPosition = 57 -; FirstLine = 48 +; CursorPosition = 911 +; FirstLine = 895 ; Folding = ---------------- ; EnableThread ; EnableXP \ No newline at end of file