diff options
Diffstat (limited to 'OpenSim/Services')
4 files changed, 93 insertions, 4 deletions
diff --git a/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs b/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs index cc485f7..725204d 100644 --- a/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs +++ b/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs | |||
@@ -86,6 +86,66 @@ 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) | ||
90 | { | ||
91 | reason = string.Empty; | ||
92 | int tickstart = Util.EnvironmentTickCount(); | ||
93 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | ||
94 | sendData["X"] = x.ToString(); | ||
95 | sendData["Y"] = y.ToString(); | ||
96 | |||
97 | string reqString = ServerUtils.BuildQueryString(sendData); | ||
98 | string uri = m_ServerURI + "/removemap"; | ||
99 | |||
100 | try | ||
101 | { | ||
102 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | ||
103 | uri, | ||
104 | reqString); | ||
105 | if (reply != string.Empty) | ||
106 | { | ||
107 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | ||
108 | |||
109 | if (replyData.ContainsKey("Result") && (replyData["Result"].ToString().ToLower() == "success")) | ||
110 | { | ||
111 | return true; | ||
112 | } | ||
113 | else if (replyData.ContainsKey("Result") && (replyData["Result"].ToString().ToLower() == "failure")) | ||
114 | { | ||
115 | m_log.DebugFormat("[MAP IMAGE CONNECTOR]: Delete failed: {0}", replyData["Message"].ToString()); | ||
116 | reason = replyData["Message"].ToString(); | ||
117 | return false; | ||
118 | } | ||
119 | else if (!replyData.ContainsKey("Result")) | ||
120 | { | ||
121 | m_log.DebugFormat("[MAP IMAGE CONNECTOR]: reply data does not contain result field"); | ||
122 | } | ||
123 | else | ||
124 | { | ||
125 | m_log.DebugFormat("[MAP IMAGE CONNECTOR]: unexpected result {0}", replyData["Result"].ToString()); | ||
126 | reason = "Unexpected result " + replyData["Result"].ToString(); | ||
127 | } | ||
128 | |||
129 | } | ||
130 | else | ||
131 | { | ||
132 | m_log.DebugFormat("[MAP IMAGE CONNECTOR]: Map post received null reply"); | ||
133 | } | ||
134 | } | ||
135 | catch (Exception e) | ||
136 | { | ||
137 | m_log.DebugFormat("[MAP IMAGE CONNECTOR]: Exception when contacting map server at {0}: {1}", uri, e.Message); | ||
138 | } | ||
139 | finally | ||
140 | { | ||
141 | // This just dumps a warning for any operation that takes more than 100 ms | ||
142 | int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); | ||
143 | m_log.DebugFormat("[MAP IMAGE CONNECTOR]: map tile deleted in {0}ms", tickdiff); | ||
144 | } | ||
145 | |||
146 | return false; | ||
147 | } | ||
148 | |||
89 | public bool AddMapTile(int x, int y, byte[] jpgData, out string reason) | 149 | public bool AddMapTile(int x, int y, byte[] jpgData, out string reason) |
90 | { | 150 | { |
91 | reason = string.Empty; | 151 | reason = string.Empty; |
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 137ce04..76415ce 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs | |||
@@ -284,7 +284,7 @@ namespace OpenSim.Services.GridService | |||
284 | 284 | ||
285 | int flags = Convert.ToInt32(region.Data["flags"]); | 285 | int flags = Convert.ToInt32(region.Data["flags"]); |
286 | 286 | ||
287 | if (!m_DeleteOnUnregister || (flags & (int)OpenSim.Framework.RegionFlags.Persistent) != 0) | 287 | if ((!m_DeleteOnUnregister) || ((flags & (int)OpenSim.Framework.RegionFlags.Persistent) != 0)) |
288 | { | 288 | { |
289 | flags &= ~(int)OpenSim.Framework.RegionFlags.RegionOnline; | 289 | flags &= ~(int)OpenSim.Framework.RegionFlags.RegionOnline; |
290 | region.Data["flags"] = flags.ToString(); | 290 | region.Data["flags"] = flags.ToString(); |
@@ -299,7 +299,6 @@ namespace OpenSim.Services.GridService | |||
299 | } | 299 | } |
300 | 300 | ||
301 | return true; | 301 | return true; |
302 | |||
303 | } | 302 | } |
304 | 303 | ||
305 | return m_Database.Delete(regionID); | 304 | return m_Database.Delete(regionID); |
diff --git a/OpenSim/Services/Interfaces/IMapImageService.cs b/OpenSim/Services/Interfaces/IMapImageService.cs index a7b2cf1..78daa5f 100644 --- a/OpenSim/Services/Interfaces/IMapImageService.cs +++ b/OpenSim/Services/Interfaces/IMapImageService.cs | |||
@@ -35,6 +35,7 @@ namespace OpenSim.Services.Interfaces | |||
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, out string reason); |
38 | bool RemoveMapTile(int x, int y, out string reason); | ||
38 | byte[] GetMapTile(string fileName, out string format); | 39 | byte[] GetMapTile(string fileName, out string format); |
39 | } | 40 | } |
40 | } | 41 | } |
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 | |||
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 | } |