From a53272c5fbc4d4db8cc4ece1ec3d4497ac5595d2 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 18 Mar 2014 02:16:00 +0100 Subject: Add delete maptile ability to MapImageService - yet untested --- .../Services/MapImageService/MapImageService.cs | 33 ++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'OpenSim/Services/MapImageService') diff --git a/OpenSim/Services/MapImageService/MapImageService.cs b/OpenSim/Services/MapImageService/MapImageService.cs index 9ba5dab..31e147b 100644 --- a/OpenSim/Services/MapImageService/MapImageService.cs +++ b/OpenSim/Services/MapImageService/MapImageService.cs @@ -112,9 +112,38 @@ namespace OpenSim.Services.MapImageService reason = e.Message; return false; } + } + + return UpdateMultiResolutionFiles(x, y, out reason); + } + + public bool RemoveMapTile(int x, int y, out string reason) + { + reason = String.Empty; + string fileName = GetFileName(1, x, y); + + lock (m_Sync) + { + try + { + File.Delete(fileName); + } + catch (Exception e) + { + m_log.WarnFormat("[MAP IMAGE SERVICE]: Unable to save delete file {0}: {1}", fileName, e); + reason = e.Message; + return false; + } + } - // Also save in png format? + return UpdateMultiResolutionFiles(x, y, out reason); + } + private bool UpdateMultiResolutionFiles(int x, int y, out string reason) + { + reason = String.Empty; + lock (m_Sync) + { // Stitch seven more aggregate tiles together for (uint zoomLevel = 2; zoomLevel <= ZOOM_LEVELS; zoomLevel++) { @@ -126,7 +155,7 @@ namespace OpenSim.Services.MapImageService if (!CreateTile(zoomLevel, x1, y1)) { - m_log.WarnFormat("[MAP IMAGE SERVICE]: Unable to create tile for {0} at zoom level {1}", fileName, zoomLevel); + m_log.WarnFormat("[MAP IMAGE SERVICE]: Unable to create tile for {0},{1} at zoom level {1}", x, y, zoomLevel); reason = string.Format("Map tile at zoom level {0} failed", zoomLevel); return false; } -- cgit v1.1