diff options
author | Melanie Thielker | 2014-03-18 02:16:00 +0100 |
---|---|---|
committer | Melanie Thielker | 2014-03-18 02:16:00 +0100 |
commit | c0cdc6b74f634da9fc79691a7965b0648cbcf800 (patch) | |
tree | 76964bf35ccaadfe5a71056c0a09a6657990f2e8 /OpenSim/Services/MapImageService/MapImageService.cs | |
parent | Minor: Add prentheses to make a condition clearer (diff) | |
download | opensim-SC-c0cdc6b74f634da9fc79691a7965b0648cbcf800.zip opensim-SC-c0cdc6b74f634da9fc79691a7965b0648cbcf800.tar.gz opensim-SC-c0cdc6b74f634da9fc79691a7965b0648cbcf800.tar.bz2 opensim-SC-c0cdc6b74f634da9fc79691a7965b0648cbcf800.tar.xz |
Add delete maptile ability to MapImageService - yet untested
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Services/MapImageService/MapImageService.cs | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/OpenSim/Services/MapImageService/MapImageService.cs b/OpenSim/Services/MapImageService/MapImageService.cs index a85ee70..e2f256f 100644 --- a/OpenSim/Services/MapImageService/MapImageService.cs +++ b/OpenSim/Services/MapImageService/MapImageService.cs | |||
@@ -112,9 +112,38 @@ namespace OpenSim.Services.MapImageService | |||
112 | reason = e.Message; | 112 | reason = e.Message; |
113 | return false; | 113 | return false; |
114 | } | 114 | } |
115 | } | ||
116 | |||
117 | return UpdateMultiResolutionFiles(x, y, out reason); | ||
118 | } | ||
119 | |||
120 | public bool RemoveMapTile(int x, int y, out string reason) | ||
121 | { | ||
122 | reason = String.Empty; | ||
123 | string fileName = GetFileName(1, x, y); | ||
124 | |||
125 | lock (m_Sync) | ||
126 | { | ||
127 | try | ||
128 | { | ||
129 | File.Delete(fileName); | ||
130 | } | ||
131 | catch (Exception e) | ||
132 | { | ||
133 | m_log.WarnFormat("[MAP IMAGE SERVICE]: Unable to save delete file {0}: {1}", fileName, e); | ||
134 | reason = e.Message; | ||
135 | return false; | ||
136 | } | ||
137 | } | ||
115 | 138 | ||
116 | // Also save in png format? | 139 | return UpdateMultiResolutionFiles(x, y, out reason); |
140 | } | ||
117 | 141 | ||
142 | private bool UpdateMultiResolutionFiles(int x, int y, out string reason) | ||
143 | { | ||
144 | reason = String.Empty; | ||
145 | lock (m_Sync) | ||
146 | { | ||
118 | // Stitch seven more aggregate tiles together | 147 | // Stitch seven more aggregate tiles together |
119 | for (uint zoomLevel = 2; zoomLevel <= ZOOM_LEVELS; zoomLevel++) | 148 | for (uint zoomLevel = 2; zoomLevel <= ZOOM_LEVELS; zoomLevel++) |
120 | { | 149 | { |
@@ -126,7 +155,7 @@ namespace OpenSim.Services.MapImageService | |||
126 | 155 | ||
127 | if (!CreateTile(zoomLevel, x1, y1)) | 156 | if (!CreateTile(zoomLevel, x1, y1)) |
128 | { | 157 | { |
129 | m_log.WarnFormat("[MAP IMAGE SERVICE]: Unable to create tile for {0} at zoom level {1}", fileName, zoomLevel); | 158 | m_log.WarnFormat("[MAP IMAGE SERVICE]: Unable to create tile for {0},{1} at zoom level {1}", x, y, zoomLevel); |
130 | reason = string.Format("Map tile at zoom level {0} failed", zoomLevel); | 159 | reason = string.Format("Map tile at zoom level {0} failed", zoomLevel); |
131 | return false; | 160 | return false; |
132 | } | 161 | } |