aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs27
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs8
-rw-r--r--OpenSim/Region/Framework/Interfaces/IMapTileModule.cs40
-rw-r--r--OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs3
-rw-r--r--OpenSim/Server/Handlers/Map/MapAddServerConnector.cs5
-rw-r--r--OpenSim/Server/Handlers/Map/MapGetServerConnector.cs12
-rw-r--r--OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs5
-rw-r--r--OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs8
-rw-r--r--OpenSim/Services/Interfaces/IGridService.cs6
-rw-r--r--OpenSim/Services/Interfaces/IMapImageService.cs6
-rw-r--r--OpenSim/Services/MapImageService/MapImageService.cs39
11 files changed, 129 insertions, 30 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index eb5d784..4c05ec8 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
@@ -168,6 +168,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
168 168
169 // Misc 169 // Misc
170 availableMethods["admin_refresh_search"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcRefreshSearch); 170 availableMethods["admin_refresh_search"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcRefreshSearch);
171 availableMethods["admin_refresh_map"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcRefreshMap);
171 availableMethods["admin_get_opensim_version"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcGetOpenSimVersion); 172 availableMethods["admin_get_opensim_version"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcGetOpenSimVersion);
172 173
173 // Either enable full remote functionality or just selected features 174 // Either enable full remote functionality or just selected features
@@ -2227,6 +2228,32 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2227 m_log.Info("[RADMIN]: Refresh Search Request complete"); 2228 m_log.Info("[RADMIN]: Refresh Search Request complete");
2228 } 2229 }
2229 2230
2231 private void XmlRpcRefreshMap(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient)
2232 {
2233 m_log.Info("[RADMIN]: Received Refresh Map Request");
2234
2235 Hashtable responseData = (Hashtable)response.Value;
2236 Hashtable requestData = (Hashtable)request.Params[0];
2237
2238 CheckRegionParams(requestData, responseData);
2239
2240 Scene scene = null;
2241 GetSceneFromRegionParams(requestData, responseData, out scene);
2242
2243 IMapTileModule mapTileModule = scene.RequestModuleInterface<IMapTileModule>();
2244 if (mapTileModule != null)
2245 {
2246 mapTileModule.UploadMapTile(scene);
2247 responseData["success"] = true;
2248 }
2249 else
2250 {
2251 responseData["success"] = false;
2252 }
2253
2254 m_log.Info("[RADMIN]: Refresh Map Request complete");
2255 }
2256
2230 private void XmlRpcGetOpenSimVersion(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient) 2257 private void XmlRpcGetOpenSimVersion(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient)
2231 { 2258 {
2232 m_log.Info("[RADMIN]: Received Get OpenSim Version Request"); 2259 m_log.Info("[RADMIN]: Received Get OpenSim Version Request");
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs
index b61062f..96182cd 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs
@@ -53,7 +53,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
53 /// </remarks> 53 /// </remarks>
54 54
55 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MapImageServiceModule")] 55 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MapImageServiceModule")]
56 public class MapImageServiceModule : ISharedRegionModule 56 public class MapImageServiceModule : ISharedRegionModule, IMapTileModule
57 { 57 {
58 private static readonly ILog m_log = 58 private static readonly ILog m_log =
59 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 59 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -143,6 +143,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
143 lock (m_scenes) 143 lock (m_scenes)
144 m_scenes[scene.RegionInfo.RegionID] = scene; 144 m_scenes[scene.RegionInfo.RegionID] = scene;
145 145
146 scene.RegisterModuleInterface<IMapTileModule>(this);
147
146 scene.EventManager.OnRegionReadyStatusChange += s => { if (s.Ready) UploadMapTile(s); }; 148 scene.EventManager.OnRegionReadyStatusChange += s => { if (s.Ready) UploadMapTile(s); };
147 } 149 }
148 150
@@ -193,7 +195,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
193 ///<summary> 195 ///<summary>
194 /// 196 ///
195 ///</summary> 197 ///</summary>
196 private void UploadMapTile(IScene scene) 198 public void UploadMapTile(IScene scene)
197 { 199 {
198 m_log.DebugFormat("[MAP IMAGE SERVICE MODULE]: upload maptile for {0}", scene.RegionInfo.RegionName); 200 m_log.DebugFormat("[MAP IMAGE SERVICE MODULE]: upload maptile for {0}", scene.RegionInfo.RegionName);
199 201
@@ -227,7 +229,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
227 } 229 }
228 230
229 string reason = string.Empty; 231 string reason = string.Empty;
230 if (!m_MapService.AddMapTile((int)scene.RegionInfo.RegionLocX, (int)scene.RegionInfo.RegionLocY, jpgData, out reason)) 232 if (!m_MapService.AddMapTile((int)scene.RegionInfo.RegionLocX, (int)scene.RegionInfo.RegionLocY, jpgData, scene.RegionInfo.ScopeID, out reason))
231 { 233 {
232 m_log.DebugFormat("[MAP IMAGE SERVICE MODULE]: Unable to upload tile image for {0} at {1}-{2}: {3}", 234 m_log.DebugFormat("[MAP IMAGE SERVICE MODULE]: Unable to upload tile image for {0} at {1}-{2}: {3}",
233 scene.RegionInfo.RegionName, scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY, reason); 235 scene.RegionInfo.RegionName, scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY, reason);
diff --git a/OpenSim/Region/Framework/Interfaces/IMapTileModule.cs b/OpenSim/Region/Framework/Interfaces/IMapTileModule.cs
new file mode 100644
index 0000000..4d64236
--- /dev/null
+++ b/OpenSim/Region/Framework/Interfaces/IMapTileModule.cs
@@ -0,0 +1,40 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using OpenMetaverse;
29using OpenSim.Framework;
30
31namespace OpenSim.Region.Framework.Interfaces
32{
33 public interface IMapTileModule
34 {
35 /// <summary>
36 /// Upload a new maptile
37 /// </summary>
38 void UploadMapTile(IScene scene);
39 }
40}
diff --git a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs
index 0b98e9a..9199c68 100644
--- a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs
@@ -184,6 +184,9 @@ namespace OpenSim.Server.Handlers.GridUser
184 184
185 GridUserInfo guinfo = m_GridUserService.GetGridUserInfo(user); 185 GridUserInfo guinfo = m_GridUserService.GetGridUserInfo(user);
186 186
187 if (guinfo == null)
188 return FailureResult();
189
187 Dictionary<string, object> result = new Dictionary<string, object>(); 190 Dictionary<string, object> result = new Dictionary<string, object>();
188 if (guinfo != null) 191 if (guinfo != null)
189 result["result"] = guinfo.ToKeyValuePairs(); 192 result["result"] = guinfo.ToKeyValuePairs();
diff --git a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs
index d438fc7..7ee347c 100644
--- a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs
+++ b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs
@@ -117,8 +117,11 @@ namespace OpenSim.Server.Handlers.MapImage
117 return FailureResult("Bad request."); 117 return FailureResult("Bad request.");
118 } 118 }
119 int x = 0, y = 0; 119 int x = 0, y = 0;
120 UUID scopeID = new UUID("07f8d88e-cd5e-4239-a0ed-843f75d09992");
120 Int32.TryParse(request["X"].ToString(), out x); 121 Int32.TryParse(request["X"].ToString(), out x);
121 Int32.TryParse(request["Y"].ToString(), out y); 122 Int32.TryParse(request["Y"].ToString(), out y);
123 if (request.ContainsKey("SCOPE"))
124 UUID.TryParse(request["SCOPE"].ToString(), out scopeID);
122 125
123 m_log.DebugFormat("[MAP ADD SERVER CONNECTOR]: Received map data for region at {0}-{1}", x, y); 126 m_log.DebugFormat("[MAP ADD SERVER CONNECTOR]: Received map data for region at {0}-{1}", x, y);
124 127
@@ -151,7 +154,7 @@ namespace OpenSim.Server.Handlers.MapImage
151 byte[] data = Convert.FromBase64String(request["DATA"].ToString()); 154 byte[] data = Convert.FromBase64String(request["DATA"].ToString());
152 155
153 string reason = string.Empty; 156 string reason = string.Empty;
154 bool result = m_MapService.AddMapTile(x, y, data, out reason); 157 bool result = m_MapService.AddMapTile(x, y, data, scopeID, out reason);
155 158
156 if (result) 159 if (result)
157 return SuccessResult(); 160 return SuccessResult();
diff --git a/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs b/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs
index bd1ddbd..e2c8f35 100644
--- a/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs
+++ b/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs
@@ -38,6 +38,7 @@ using OpenSim.Server.Base;
38using OpenSim.Services.Interfaces; 38using OpenSim.Services.Interfaces;
39using OpenSim.Framework.Servers.HttpServer; 39using OpenSim.Framework.Servers.HttpServer;
40using OpenSim.Server.Handlers.Base; 40using OpenSim.Server.Handlers.Base;
41using OpenMetaverse;
41 42
42namespace OpenSim.Server.Handlers.MapImage 43namespace OpenSim.Server.Handlers.MapImage
43{ 44{
@@ -93,7 +94,16 @@ namespace OpenSim.Server.Handlers.MapImage
93 94
94 byte[] result = new byte[0]; 95 byte[] result = new byte[0];
95 string format = string.Empty; 96 string format = string.Empty;
96 result = m_MapService.GetMapTile(path.Trim('/'), out format); 97
98 UUID scopeID = new UUID("07f8d88e-cd5e-4239-a0ed-843f75d09992");
99
100 string[] bits = path.Trim('/').Split(new char[] {'/'});
101 if (bits.Length > 1)
102 {
103 scopeID = new UUID(bits[0]);
104 path = bits[1];
105 }
106 result = m_MapService.GetMapTile(path.Trim('/'), scopeID, out format);
97 if (result.Length > 0) 107 if (result.Length > 0)
98 { 108 {
99 httpResponse.StatusCode = (int)HttpStatusCode.OK; 109 httpResponse.StatusCode = (int)HttpStatusCode.OK;
diff --git a/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs b/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs
index 80e3535..8a31579 100644
--- a/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs
+++ b/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs
@@ -119,6 +119,9 @@ namespace OpenSim.Server.Handlers.MapImage
119 int x = 0, y = 0; 119 int x = 0, y = 0;
120 Int32.TryParse(request["X"].ToString(), out x); 120 Int32.TryParse(request["X"].ToString(), out x);
121 Int32.TryParse(request["Y"].ToString(), out y); 121 Int32.TryParse(request["Y"].ToString(), out y);
122 UUID scopeID = new UUID("07f8d88e-cd5e-4239-a0ed-843f75d09992");
123 if (request.ContainsKey("SCOPE"))
124 UUID.TryParse(request["SCOPE"].ToString(), out scopeID);
122 125
123 m_log.DebugFormat("[MAP REMOVE SERVER CONNECTOR]: Received position data for region at {0}-{1}", x, y); 126 m_log.DebugFormat("[MAP REMOVE SERVER CONNECTOR]: Received position data for region at {0}-{1}", x, y);
124 127
@@ -144,7 +147,7 @@ namespace OpenSim.Server.Handlers.MapImage
144 } 147 }
145 148
146 string reason = string.Empty; 149 string reason = string.Empty;
147 bool result = m_MapService.RemoveMapTile(x, y, out reason); 150 bool result = m_MapService.RemoveMapTile(x, y, scopeID, out reason);
148 151
149 if (result) 152 if (result)
150 return SuccessResult(); 153 return SuccessResult();
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;