diff options
author | Marck | 2010-12-13 21:19:33 +0100 |
---|---|---|
committer | Marck | 2010-12-13 21:20:48 +0100 |
commit | 9a24c0b41c786f49766c212c656f8162e4c263ef (patch) | |
tree | d10e0ee6fa7398d79a937426218c7a6ee80e6aa7 /OpenSim/Services/GridService | |
parent | It turns out that the 1/2 sec burst for prims download is not a bug, but a fe... (diff) | |
download | opensim-SC-9a24c0b41c786f49766c212c656f8162e4c263ef.zip opensim-SC-9a24c0b41c786f49766c212c656f8162e4c263ef.tar.gz opensim-SC-9a24c0b41c786f49766c212c656f8162e4c263ef.tar.bz2 opensim-SC-9a24c0b41c786f49766c212c656f8162e4c263ef.tar.xz |
Show map tile for hyperlinks. Perform Check4096 before adding a hyperlink.
Configuration option AssetService in section [GridService] must be set to enable this functionality.
Map tiles do currently not show for hyperlinks set in simulators that are connected to grids, see Mantis #5270.
Diffstat (limited to 'OpenSim/Services/GridService')
-rw-r--r-- | OpenSim/Services/GridService/HypergridLinker.cs | 76 |
1 files changed, 42 insertions, 34 deletions
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 9863ba0..643d0fc 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.IO; | ||
31 | using System.Linq; | 32 | using System.Linq; |
32 | using System.Net; | 33 | using System.Net; |
33 | using System.Reflection; | 34 | using System.Reflection; |
@@ -52,8 +53,6 @@ namespace OpenSim.Services.GridService | |||
52 | LogManager.GetLogger( | 53 | LogManager.GetLogger( |
53 | MethodBase.GetCurrentMethod().DeclaringType); | 54 | MethodBase.GetCurrentMethod().DeclaringType); |
54 | 55 | ||
55 | private static UUID m_HGMapImage = new UUID("00000000-0000-1111-9999-000000000013"); | ||
56 | |||
57 | private static uint m_autoMappingX = 0; | 56 | private static uint m_autoMappingX = 0; |
58 | private static uint m_autoMappingY = 0; | 57 | private static uint m_autoMappingY = 0; |
59 | private static bool m_enableAutoMapping = false; | 58 | private static bool m_enableAutoMapping = false; |
@@ -65,6 +64,7 @@ namespace OpenSim.Services.GridService | |||
65 | 64 | ||
66 | protected UUID m_ScopeID = UUID.Zero; | 65 | protected UUID m_ScopeID = UUID.Zero; |
67 | protected bool m_Check4096 = true; | 66 | protected bool m_Check4096 = true; |
67 | protected string m_MapTileDirectory = string.Empty; | ||
68 | 68 | ||
69 | // Hyperlink regions are hyperlinks on the map | 69 | // Hyperlink regions are hyperlinks on the map |
70 | public readonly Dictionary<UUID, GridRegion> m_HyperlinkRegions = new Dictionary<UUID, GridRegion>(); | 70 | public readonly Dictionary<UUID, GridRegion> m_HyperlinkRegions = new Dictionary<UUID, GridRegion>(); |
@@ -121,9 +121,24 @@ namespace OpenSim.Services.GridService | |||
121 | 121 | ||
122 | m_Check4096 = gridConfig.GetBoolean("Check4096", true); | 122 | m_Check4096 = gridConfig.GetBoolean("Check4096", true); |
123 | 123 | ||
124 | m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", string.Empty); | ||
125 | |||
124 | m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService); | 126 | m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService); |
125 | 127 | ||
126 | m_log.DebugFormat("[HYPERGRID LINKER]: Loaded all services..."); | 128 | m_log.Debug("[HYPERGRID LINKER]: Loaded all services..."); |
129 | } | ||
130 | |||
131 | if (!string.IsNullOrEmpty(m_MapTileDirectory)) | ||
132 | { | ||
133 | try | ||
134 | { | ||
135 | Directory.CreateDirectory(m_MapTileDirectory); | ||
136 | } | ||
137 | catch (Exception e) | ||
138 | { | ||
139 | m_log.WarnFormat("[HYPERGRID LINKER]: Could not create map tile storage directory {0}: {1}", m_MapTileDirectory, e); | ||
140 | m_MapTileDirectory = string.Empty; | ||
141 | } | ||
127 | } | 142 | } |
128 | 143 | ||
129 | if (MainConsole.Instance != null) | 144 | if (MainConsole.Instance != null) |
@@ -271,42 +286,22 @@ namespace OpenSim.Services.GridService | |||
271 | if (!m_GatekeeperConnector.LinkRegion(regInfo, out regionID, out handle, out externalName, out imageURL, out reason)) | 286 | if (!m_GatekeeperConnector.LinkRegion(regInfo, out regionID, out handle, out externalName, out imageURL, out reason)) |
272 | return false; | 287 | return false; |
273 | 288 | ||
274 | if (regionID != UUID.Zero) | 289 | if (regionID == UUID.Zero) |
275 | { | ||
276 | region = m_GridService.GetRegionByUUID(scopeID, regionID); | ||
277 | if (region != null) | ||
278 | { | ||
279 | m_log.DebugFormat("[HYPERGRID LINKER]: Region already exists in coordinates {0} {1}", | ||
280 | region.RegionLocX / Constants.RegionSize, region.RegionLocY / Constants.RegionSize); | ||
281 | regInfo = region; | ||
282 | return true; | ||
283 | } | ||
284 | |||
285 | regInfo.RegionID = regionID; | ||
286 | |||
287 | if ( externalName == string.Empty ) | ||
288 | regInfo.RegionName = regInfo.ServerURI; | ||
289 | else | ||
290 | regInfo.RegionName = externalName; | ||
291 | |||
292 | m_log.Debug("[HYPERGRID LINKER]: naming linked region " + regInfo.RegionName); | ||
293 | |||
294 | // Try get the map image | ||
295 | //regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL); | ||
296 | // I need a texture that works for this... the one I tried doesn't seem to be working | ||
297 | regInfo.TerrainImage = m_HGMapImage; | ||
298 | |||
299 | AddHyperlinkRegion(regInfo, handle); | ||
300 | m_log.Info("[HYPERGRID LINKER]: Successfully linked to region_uuid " + regInfo.RegionID); | ||
301 | |||
302 | } | ||
303 | else | ||
304 | { | 290 | { |
305 | m_log.Warn("[HYPERGRID LINKER]: Unable to link region"); | 291 | m_log.Warn("[HYPERGRID LINKER]: Unable to link region"); |
306 | reason = "Remote region could not be found"; | 292 | reason = "Remote region could not be found"; |
307 | return false; | 293 | return false; |
308 | } | 294 | } |
309 | 295 | ||
296 | region = m_GridService.GetRegionByUUID(scopeID, regionID); | ||
297 | if (region != null) | ||
298 | { | ||
299 | m_log.DebugFormat("[HYPERGRID LINKER]: Region already exists in coordinates {0} {1}", | ||
300 | region.RegionLocX / Constants.RegionSize, region.RegionLocY / Constants.RegionSize); | ||
301 | regInfo = region; | ||
302 | return true; | ||
303 | } | ||
304 | |||
310 | uint x, y; | 305 | uint x, y; |
311 | if (m_Check4096 && !Check4096(handle, out x, out y)) | 306 | if (m_Check4096 && !Check4096(handle, out x, out y)) |
312 | { | 307 | { |
@@ -316,7 +311,20 @@ namespace OpenSim.Services.GridService | |||
316 | return false; | 311 | return false; |
317 | } | 312 | } |
318 | 313 | ||
319 | m_log.Debug("[HYPERGRID LINKER]: link region succeeded"); | 314 | regInfo.RegionID = regionID; |
315 | |||
316 | if ( externalName == string.Empty ) | ||
317 | regInfo.RegionName = regInfo.ServerURI; | ||
318 | else | ||
319 | regInfo.RegionName = externalName; | ||
320 | |||
321 | m_log.Debug("[HYPERGRID LINKER]: naming linked region " + regInfo.RegionName); | ||
322 | |||
323 | // Get the map image | ||
324 | regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL, m_MapTileDirectory); | ||
325 | |||
326 | AddHyperlinkRegion(regInfo, handle); | ||
327 | m_log.Info("[HYPERGRID LINKER]: Successfully linked to region_uuid " + regInfo.RegionID); | ||
320 | return true; | 328 | return true; |
321 | } | 329 | } |
322 | 330 | ||