diff options
Diffstat (limited to 'OpenSim/Services')
4 files changed, 35 insertions, 24 deletions
diff --git a/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs b/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs index 725204d..ba4c3c5 100644 --- a/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs +++ b/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs | |||
@@ -86,13 +86,14 @@ namespace OpenSim.Services.Connectors | |||
86 | m_ServerURI = serviceURI.TrimEnd('/'); | 86 | m_ServerURI = serviceURI.TrimEnd('/'); |
87 | } | 87 | } |
88 | 88 | ||
89 | public bool RemoveMapTile(int x, int y, out string reason) | 89 | public bool RemoveMapTile(int x, int y, UUID scopeID, out string reason) |
90 | { | 90 | { |
91 | reason = string.Empty; | 91 | reason = string.Empty; |
92 | int tickstart = Util.EnvironmentTickCount(); | 92 | int tickstart = Util.EnvironmentTickCount(); |
93 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | 93 | Dictionary<string, object> sendData = new Dictionary<string, object>(); |
94 | sendData["X"] = x.ToString(); | 94 | sendData["X"] = x.ToString(); |
95 | sendData["Y"] = y.ToString(); | 95 | sendData["Y"] = y.ToString(); |
96 | sendData["SCOPE"] = scopeID.ToString(); | ||
96 | 97 | ||
97 | string reqString = ServerUtils.BuildQueryString(sendData); | 98 | string reqString = ServerUtils.BuildQueryString(sendData); |
98 | string uri = m_ServerURI + "/removemap"; | 99 | string uri = m_ServerURI + "/removemap"; |
@@ -146,13 +147,14 @@ namespace OpenSim.Services.Connectors | |||
146 | return false; | 147 | return false; |
147 | } | 148 | } |
148 | 149 | ||
149 | public bool AddMapTile(int x, int y, byte[] jpgData, out string reason) | 150 | public bool AddMapTile(int x, int y, byte[] jpgData, UUID scopeID, out string reason) |
150 | { | 151 | { |
151 | reason = string.Empty; | 152 | reason = string.Empty; |
152 | int tickstart = Util.EnvironmentTickCount(); | 153 | int tickstart = Util.EnvironmentTickCount(); |
153 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | 154 | Dictionary<string, object> sendData = new Dictionary<string, object>(); |
154 | sendData["X"] = x.ToString(); | 155 | sendData["X"] = x.ToString(); |
155 | sendData["Y"] = y.ToString(); | 156 | sendData["Y"] = y.ToString(); |
157 | sendData["SCOPE"] = scopeID.ToString(); | ||
156 | sendData["TYPE"] = "image/jpeg"; | 158 | sendData["TYPE"] = "image/jpeg"; |
157 | sendData["DATA"] = Convert.ToBase64String(jpgData); | 159 | sendData["DATA"] = Convert.ToBase64String(jpgData); |
158 | 160 | ||
@@ -212,7 +214,7 @@ namespace OpenSim.Services.Connectors | |||
212 | 214 | ||
213 | } | 215 | } |
214 | 216 | ||
215 | public byte[] GetMapTile(string fileName, out string format) | 217 | public byte[] GetMapTile(string fileName, UUID scopeID, out string format) |
216 | { | 218 | { |
217 | format = string.Empty; | 219 | format = string.Empty; |
218 | new Exception("GetMapTile method not Implemented"); | 220 | new Exception("GetMapTile method not Implemented"); |
diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs index 4466222..4e6a0f6 100644 --- a/OpenSim/Services/Interfaces/IGridService.cs +++ b/OpenSim/Services/Interfaces/IGridService.cs | |||
@@ -152,6 +152,12 @@ namespace OpenSim.Services.Interfaces | |||
152 | } | 152 | } |
153 | } | 153 | } |
154 | set { | 154 | set { |
155 | if ( value == null) | ||
156 | { | ||
157 | m_serverURI = String.Empty; | ||
158 | return; | ||
159 | } | ||
160 | |||
155 | if ( value.EndsWith("/") ) { | 161 | if ( value.EndsWith("/") ) { |
156 | m_serverURI = value; | 162 | m_serverURI = value; |
157 | } else { | 163 | } else { |
diff --git a/OpenSim/Services/Interfaces/IMapImageService.cs b/OpenSim/Services/Interfaces/IMapImageService.cs index 78daa5f..b8d45dd 100644 --- a/OpenSim/Services/Interfaces/IMapImageService.cs +++ b/OpenSim/Services/Interfaces/IMapImageService.cs | |||
@@ -34,8 +34,8 @@ namespace OpenSim.Services.Interfaces | |||
34 | public interface IMapImageService | 34 | public interface IMapImageService |
35 | { | 35 | { |
36 | //List<MapBlockData> GetMapBlocks(UUID scopeID, int minX, int minY, int maxX, int maxY); | 36 | //List<MapBlockData> GetMapBlocks(UUID scopeID, int minX, int minY, int maxX, int maxY); |
37 | bool AddMapTile(int x, int y, byte[] imageData, out string reason); | 37 | bool AddMapTile(int x, int y, byte[] imageData, UUID scopeID, out string reason); |
38 | bool RemoveMapTile(int x, int y, out string reason); | 38 | bool RemoveMapTile(int x, int y, UUID scopeID, out string reason); |
39 | byte[] GetMapTile(string fileName, out string format); | 39 | byte[] GetMapTile(string fileName, UUID scopeID, out string format); |
40 | } | 40 | } |
41 | } | 41 | } |
diff --git a/OpenSim/Services/MapImageService/MapImageService.cs b/OpenSim/Services/MapImageService/MapImageService.cs index 31e147b..4887d1c 100644 --- a/OpenSim/Services/MapImageService/MapImageService.cs +++ b/OpenSim/Services/MapImageService/MapImageService.cs | |||
@@ -94,10 +94,10 @@ namespace OpenSim.Services.MapImageService | |||
94 | 94 | ||
95 | #region IMapImageService | 95 | #region IMapImageService |
96 | 96 | ||
97 | public bool AddMapTile(int x, int y, byte[] imageData, out string reason) | 97 | public bool AddMapTile(int x, int y, byte[] imageData, UUID scopeID, out string reason) |
98 | { | 98 | { |
99 | reason = string.Empty; | 99 | reason = string.Empty; |
100 | string fileName = GetFileName(1, x, y); | 100 | string fileName = GetFileName(1, x, y, scopeID); |
101 | 101 | ||
102 | lock (m_Sync) | 102 | lock (m_Sync) |
103 | { | 103 | { |
@@ -114,13 +114,13 @@ namespace OpenSim.Services.MapImageService | |||
114 | } | 114 | } |
115 | } | 115 | } |
116 | 116 | ||
117 | return UpdateMultiResolutionFiles(x, y, out reason); | 117 | return UpdateMultiResolutionFiles(x, y, scopeID, out reason); |
118 | } | 118 | } |
119 | 119 | ||
120 | public bool RemoveMapTile(int x, int y, out string reason) | 120 | public bool RemoveMapTile(int x, int y, UUID scopeID, out string reason) |
121 | { | 121 | { |
122 | reason = String.Empty; | 122 | reason = String.Empty; |
123 | string fileName = GetFileName(1, x, y); | 123 | string fileName = GetFileName(1, x, y, scopeID); |
124 | 124 | ||
125 | lock (m_Sync) | 125 | lock (m_Sync) |
126 | { | 126 | { |
@@ -136,10 +136,10 @@ namespace OpenSim.Services.MapImageService | |||
136 | } | 136 | } |
137 | } | 137 | } |
138 | 138 | ||
139 | return UpdateMultiResolutionFiles(x, y, out reason); | 139 | return UpdateMultiResolutionFiles(x, y, scopeID, out reason); |
140 | } | 140 | } |
141 | 141 | ||
142 | private bool UpdateMultiResolutionFiles(int x, int y, out string reason) | 142 | private bool UpdateMultiResolutionFiles(int x, int y, UUID scopeID, out string reason) |
143 | { | 143 | { |
144 | reason = String.Empty; | 144 | reason = String.Empty; |
145 | lock (m_Sync) | 145 | lock (m_Sync) |
@@ -153,7 +153,7 @@ namespace OpenSim.Services.MapImageService | |||
153 | int x1 = x - (x % width); | 153 | int x1 = x - (x % width); |
154 | int y1 = y - (y % width); | 154 | int y1 = y - (y % width); |
155 | 155 | ||
156 | if (!CreateTile(zoomLevel, x1, y1)) | 156 | if (!CreateTile(zoomLevel, x1, y1, scopeID)) |
157 | { | 157 | { |
158 | m_log.WarnFormat("[MAP IMAGE SERVICE]: Unable to create tile for {0},{1} at zoom level {1}", x, y, zoomLevel); | 158 | m_log.WarnFormat("[MAP IMAGE SERVICE]: Unable to create tile for {0},{1} at zoom level {1}", x, y, zoomLevel); |
159 | reason = string.Format("Map tile at zoom level {0} failed", zoomLevel); | 159 | reason = string.Format("Map tile at zoom level {0} failed", zoomLevel); |
@@ -165,12 +165,13 @@ namespace OpenSim.Services.MapImageService | |||
165 | return true; | 165 | return true; |
166 | } | 166 | } |
167 | 167 | ||
168 | public byte[] GetMapTile(string fileName, out string format) | 168 | public byte[] GetMapTile(string fileName, UUID scopeID, out string format) |
169 | { | 169 | { |
170 | // m_log.DebugFormat("[MAP IMAGE SERVICE]: Getting map tile {0}", fileName); | 170 | // m_log.DebugFormat("[MAP IMAGE SERVICE]: Getting map tile {0}", fileName); |
171 | 171 | ||
172 | format = ".jpg"; | 172 | format = ".jpg"; |
173 | string fullName = Path.Combine(m_TilesStoragePath, fileName); | 173 | string fullName = Path.Combine(m_TilesStoragePath, scopeID.ToString()); |
174 | fullName = Path.Combine(fullName, fileName); | ||
174 | if (File.Exists(fullName)) | 175 | if (File.Exists(fullName)) |
175 | { | 176 | { |
176 | format = Path.GetExtension(fileName).ToLower(); | 177 | format = Path.GetExtension(fileName).ToLower(); |
@@ -191,10 +192,12 @@ namespace OpenSim.Services.MapImageService | |||
191 | #endregion | 192 | #endregion |
192 | 193 | ||
193 | 194 | ||
194 | private string GetFileName(uint zoomLevel, int x, int y) | 195 | private string GetFileName(uint zoomLevel, int x, int y, UUID scopeID) |
195 | { | 196 | { |
196 | string extension = "jpg"; | 197 | string extension = "jpg"; |
197 | return Path.Combine(m_TilesStoragePath, string.Format("map-{0}-{1}-{2}-objects.{3}", zoomLevel, x, y, extension)); | 198 | string path = Path.Combine(m_TilesStoragePath, scopeID.ToString()); |
199 | Directory.CreateDirectory(path); | ||
200 | return Path.Combine(path, string.Format("map-{0}-{1}-{2}-objects.{3}", zoomLevel, x, y, extension)); | ||
198 | } | 201 | } |
199 | 202 | ||
200 | private Bitmap GetInputTileImage(string fileName) | 203 | private Bitmap GetInputTileImage(string fileName) |
@@ -235,7 +238,7 @@ namespace OpenSim.Services.MapImageService | |||
235 | return null; | 238 | return null; |
236 | } | 239 | } |
237 | 240 | ||
238 | private bool CreateTile(uint zoomLevel, int x, int y) | 241 | private bool CreateTile(uint zoomLevel, int x, int y, UUID scopeID) |
239 | { | 242 | { |
240 | // m_log.DebugFormat("[MAP IMAGE SERVICE]: Create tile for {0} {1}, zoom {2}", x, y, zoomLevel); | 243 | // m_log.DebugFormat("[MAP IMAGE SERVICE]: Create tile for {0} {1}, zoom {2}", x, y, zoomLevel); |
241 | int prevWidth = (int)Math.Pow(2, (double)zoomLevel - 2); | 244 | int prevWidth = (int)Math.Pow(2, (double)zoomLevel - 2); |
@@ -250,13 +253,13 @@ namespace OpenSim.Services.MapImageService | |||
250 | int yOut = y - (y % thisWidth); | 253 | int yOut = y - (y % thisWidth); |
251 | 254 | ||
252 | // Try to open the four input tiles from the previous zoom level | 255 | // Try to open the four input tiles from the previous zoom level |
253 | Bitmap inputBL = GetInputTileImage(GetFileName(zoomLevel - 1, xIn, yIn)); | 256 | Bitmap inputBL = GetInputTileImage(GetFileName(zoomLevel - 1, xIn, yIn, scopeID)); |
254 | Bitmap inputBR = GetInputTileImage(GetFileName(zoomLevel - 1, xIn + prevWidth, yIn)); | 257 | Bitmap inputBR = GetInputTileImage(GetFileName(zoomLevel - 1, xIn + prevWidth, yIn, scopeID)); |
255 | Bitmap inputTL = GetInputTileImage(GetFileName(zoomLevel - 1, xIn, yIn + prevWidth)); | 258 | Bitmap inputTL = GetInputTileImage(GetFileName(zoomLevel - 1, xIn, yIn + prevWidth, scopeID)); |
256 | Bitmap inputTR = GetInputTileImage(GetFileName(zoomLevel - 1, xIn + prevWidth, yIn + prevWidth)); | 259 | Bitmap inputTR = GetInputTileImage(GetFileName(zoomLevel - 1, xIn + prevWidth, yIn + prevWidth, scopeID)); |
257 | 260 | ||
258 | // Open the output tile (current zoom level) | 261 | // Open the output tile (current zoom level) |
259 | string outputFile = GetFileName(zoomLevel, xOut, yOut); | 262 | string outputFile = GetFileName(zoomLevel, xOut, yOut, scopeID); |
260 | Bitmap output = GetOutputTileImage(outputFile); | 263 | Bitmap output = GetOutputTileImage(outputFile); |
261 | if (output == null) | 264 | if (output == null) |
262 | return false; | 265 | return false; |