aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs29
-rw-r--r--OpenSim/Services/GridService/HypergridLinker.cs76
-rw-r--r--OpenSim/Services/HypergridService/GatekeeperService.cs29
-rw-r--r--bin/Robust.HG.ini.example6
-rw-r--r--bin/config-include/GridCommon.ini.example3
-rw-r--r--bin/config-include/GridHypergrid.ini9
-rw-r--r--bin/config-include/StandaloneCommon.ini.example3
-rw-r--r--bin/config-include/StandaloneHypergrid.ini11
8 files changed, 95 insertions, 71 deletions
diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
index 85c1380..d4fd1b8 100644
--- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
@@ -29,6 +29,7 @@ using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Drawing; 31using System.Drawing;
32using System.IO;
32using System.Net; 33using System.Net;
33using System.Reflection; 34using System.Reflection;
34using OpenSim.Framework; 35using OpenSim.Framework;
@@ -48,7 +49,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
48 { 49 {
49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
50 51
51// private static UUID m_HGMapImage = new UUID("00000000-0000-1111-9999-000000000013"); 52 private static UUID m_HGMapImage = new UUID("00000000-0000-1111-9999-000000000013");
52 53
53 private IAssetService m_AssetService; 54 private IAssetService m_AssetService;
54 55
@@ -143,24 +144,25 @@ namespace OpenSim.Services.Connectors.Hypergrid
143 return true; 144 return true;
144 } 145 }
145 146
146 UUID m_MissingTexture = new UUID("5748decc-f629-461c-9a36-a35a221fe21f"); 147 public UUID GetMapImage(UUID regionID, string imageURL, string storagePath)
147
148 public UUID GetMapImage(UUID regionID, string imageURL)
149 { 148 {
150 if (m_AssetService == null) 149 if (m_AssetService == null)
151 return m_MissingTexture; 150 return m_HGMapImage;
152 151
152 UUID mapTile = m_HGMapImage;
153 string filename = string.Empty;
154 Bitmap bitmap = null;
153 try 155 try
154 { 156 {
155
156 WebClient c = new WebClient(); 157 WebClient c = new WebClient();
157 //m_log.Debug("JPEG: " + imageURL); 158 //m_log.Debug("JPEG: " + imageURL);
158 string filename = regionID.ToString(); 159 string name = regionID.ToString();
159 c.DownloadFile(imageURL, filename + ".jpg"); 160 filename = Path.Combine(storagePath, name + ".jpg");
160 Bitmap m = new Bitmap(filename + ".jpg"); 161 c.DownloadFile(imageURL, filename);
162 bitmap = new Bitmap(filename);
161 //m_log.Debug("Size: " + m.PhysicalDimension.Height + "-" + m.PhysicalDimension.Width); 163 //m_log.Debug("Size: " + m.PhysicalDimension.Height + "-" + m.PhysicalDimension.Width);
162 byte[] imageData = OpenJPEG.EncodeFromImage(m, true); 164 byte[] imageData = OpenJPEG.EncodeFromImage(bitmap, true);
163 AssetBase ass = new AssetBase(UUID.Random(), "region " + filename, (sbyte)AssetType.Texture, regionID.ToString()); 165 AssetBase ass = new AssetBase(UUID.Random(), "region " + name, (sbyte)AssetType.Texture, regionID.ToString());
164 166
165 // !!! for now 167 // !!! for now
166 //info.RegionSettings.TerrainImageID = ass.FullID; 168 //info.RegionSettings.TerrainImageID = ass.FullID;
@@ -172,14 +174,13 @@ namespace OpenSim.Services.Connectors.Hypergrid
172 m_AssetService.Store(ass); 174 m_AssetService.Store(ass);
173 175
174 // finally 176 // finally
175 return ass.FullID; 177 mapTile = ass.FullID;
176
177 } 178 }
178 catch // LEGIT: Catching problems caused by OpenJPEG p/invoke 179 catch // LEGIT: Catching problems caused by OpenJPEG p/invoke
179 { 180 {
180 m_log.Warn("[GATEKEEPER SERVICE CONNECTOR]: Failed getting/storing map image, because it is probably already in the cache"); 181 m_log.Warn("[GATEKEEPER SERVICE CONNECTOR]: Failed getting/storing map image, because it is probably already in the cache");
181 } 182 }
182 return UUID.Zero; 183 return mapTile;
183 } 184 }
184 185
185 public GridRegion GetHyperlinkRegion(GridRegion gatekeeper, UUID regionID) 186 public GridRegion GetHyperlinkRegion(GridRegion gatekeeper, UUID regionID)
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 @@
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.IO;
31using System.Linq; 32using System.Linq;
32using System.Net; 33using System.Net;
33using System.Reflection; 34using 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
diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs
index 05be7b8..4419201 100644
--- a/OpenSim/Services/HypergridService/GatekeeperService.cs
+++ b/OpenSim/Services/HypergridService/GatekeeperService.cs
@@ -123,42 +123,39 @@ namespace OpenSim.Services.HypergridService
123 externalName = m_ExternalName + ((regionName != string.Empty) ? " " + regionName : ""); 123 externalName = m_ExternalName + ((regionName != string.Empty) ? " " + regionName : "");
124 imageURL = string.Empty; 124 imageURL = string.Empty;
125 reason = string.Empty; 125 reason = string.Empty;
126 126 GridRegion region = null;
127 127
128 m_log.DebugFormat("[GATEKEEPER SERVICE]: Request to link to {0}", (regionName == string.Empty)? "default region" : regionName); 128 m_log.DebugFormat("[GATEKEEPER SERVICE]: Request to link to {0}", (regionName == string.Empty)? "default region" : regionName);
129 if (!m_AllowTeleportsToAnyRegion || regionName == string.Empty) 129 if (!m_AllowTeleportsToAnyRegion || regionName == string.Empty)
130 { 130 {
131 List<GridRegion> defs = m_GridService.GetDefaultRegions(m_ScopeID); 131 List<GridRegion> defs = m_GridService.GetDefaultRegions(m_ScopeID);
132 if (defs != null && defs.Count > 0) 132 if (defs != null && defs.Count > 0)
133 m_DefaultGatewayRegion = defs[0];
134
135 try
136 { 133 {
137 regionID = m_DefaultGatewayRegion.RegionID; 134 region = defs[0];
138 regionHandle = m_DefaultGatewayRegion.RegionHandle; 135 m_DefaultGatewayRegion = region;
139 } 136 }
140 catch 137 else
141 { 138 {
142 reason = "Grid setup problem. Try specifying a particular region here."; 139 reason = "Grid setup problem. Try specifying a particular region here.";
143 m_log.DebugFormat("[GATEKEEPER SERVICE]: Unable to send information. Please specify a default region for this grid!"); 140 m_log.DebugFormat("[GATEKEEPER SERVICE]: Unable to send information. Please specify a default region for this grid!");
144 return false; 141 return false;
145 } 142 }
146
147 return true;
148 } 143 }
149 144 else
150 GridRegion region = m_GridService.GetRegionByName(m_ScopeID, regionName);
151 if (region == null)
152 { 145 {
153 reason = "Region not found"; 146 region = m_GridService.GetRegionByName(m_ScopeID, regionName);
154 return false; 147 if (region == null)
148 {
149 reason = "Region not found";
150 return false;
151 }
155 } 152 }
156 153
157 regionID = region.RegionID; 154 regionID = region.RegionID;
158 regionHandle = region.RegionHandle; 155 regionHandle = region.RegionHandle;
159 string regionimage = "regionImage" + region.RegionID.ToString();
160 regionimage = regionimage.Replace("-", "");
161 156
157 string regionimage = "regionImage" + regionID.ToString();
158 regionimage = regionimage.Replace("-", "");
162 imageURL = region.ServerURI + "index.php?method=" + regionimage; 159 imageURL = region.ServerURI + "index.php?method=" + regionimage;
163 160
164 return true; 161 return true;
diff --git a/bin/Robust.HG.ini.example b/bin/Robust.HG.ini.example
index c690e06..9adf1ac 100644
--- a/bin/Robust.HG.ini.example
+++ b/bin/Robust.HG.ini.example
@@ -68,6 +68,12 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
68 ;; Perform distance check for the creation of a linked region 68 ;; Perform distance check for the creation of a linked region
69 ; Check4096 = "True" 69 ; Check4096 = "True"
70 70
71 ;; Needed to display non-default map tile images for linked regions
72 AssetService = "OpenSim.Services.AssetService.dll:AssetService"
73
74 ;; Directory for map tile images of linked regions
75 ; MapTileDirectory = "./"
76
71 ;; Next, we can specify properties of regions, including default and fallback regions 77 ;; Next, we can specify properties of regions, including default and fallback regions
72 ;; The syntax is: Region_<RegionName> = "<flags>" 78 ;; The syntax is: Region_<RegionName> = "<flags>"
73 ;; or: Region_<RegionID> = "<flags>" 79 ;; or: Region_<RegionID> = "<flags>"
diff --git a/bin/config-include/GridCommon.ini.example b/bin/config-include/GridCommon.ini.example
index 1122cbd..761e5eb 100644
--- a/bin/config-include/GridCommon.ini.example
+++ b/bin/config-include/GridCommon.ini.example
@@ -42,6 +42,9 @@
42 GridServerURI = "http://mygridserver.com:8003" 42 GridServerURI = "http://mygridserver.com:8003"
43 ;AllowHypergridMapSearch = true 43 ;AllowHypergridMapSearch = true
44 44
45 ;; Directory for map tile images of linked regions
46 ; MapTileDirectory = "./"
47
45[AvatarService] 48[AvatarService]
46 ; 49 ;
47 ; change this to your grid-wide grid server 50 ; change this to your grid-wide grid server
diff --git a/bin/config-include/GridHypergrid.ini b/bin/config-include/GridHypergrid.ini
index 409b2a9..e983755 100644
--- a/bin/config-include/GridHypergrid.ini
+++ b/bin/config-include/GridHypergrid.ini
@@ -44,12 +44,15 @@
44 LocalGridInventoryService = "OpenSim.Region.CoreModules.dll:RemoteXInventoryServicesConnector" 44 LocalGridInventoryService = "OpenSim.Region.CoreModules.dll:RemoteXInventoryServicesConnector"
45 45
46[GridService] 46[GridService]
47 ; RemoteGridServicesConnector instantiates a LocalGridServicesConnector, 47 ; RemoteGridServicesConnector instantiates a LocalGridServicesConnector,
48 ; which in turn uses this 48 ; which in turn uses this
49 LocalServiceModule = "OpenSim.Services.GridService.dll:GridService" 49 LocalServiceModule = "OpenSim.Services.GridService.dll:GridService"
50 StorageProvider = "OpenSim.Data.Null.dll:NullRegionData" 50 StorageProvider = "OpenSim.Data.Null.dll:NullRegionData"
51 51
52 AllowHypergridMapSearch = true 52 ; Needed to display non-default map tile images for linked regions
53 AssetService = "OpenSim.Services.Connectors.dll:AssetServicesConnector"
54
55 AllowHypergridMapSearch = true
53 56
54[LibraryService] 57[LibraryService]
55 LocalServiceModule = "OpenSim.Services.InventoryService.dll:LibraryService" 58 LocalServiceModule = "OpenSim.Services.InventoryService.dll:LibraryService"
diff --git a/bin/config-include/StandaloneCommon.ini.example b/bin/config-include/StandaloneCommon.ini.example
index 58059f5..4956bc3 100644
--- a/bin/config-include/StandaloneCommon.ini.example
+++ b/bin/config-include/StandaloneCommon.ini.example
@@ -65,6 +65,9 @@
65 ;; With hypergrid, perform distance check for the creation of a linked region 65 ;; With hypergrid, perform distance check for the creation of a linked region
66 ; Check4096 = true 66 ; Check4096 = true
67 67
68 ;; Directory for map tile images of remote regions
69 ; MapTileDirectory = "./"
70
68 ;; Next, we can specify properties of regions, including default and fallback regions 71 ;; Next, we can specify properties of regions, including default and fallback regions
69 ;; The syntax is: Region_<RegioName> = "<flags>" 72 ;; The syntax is: Region_<RegioName> = "<flags>"
70 ;; where <flags> can be DefaultRegion, FallbackRegion, NoDirectLogin, Persistent, LockedOut 73 ;; where <flags> can be DefaultRegion, FallbackRegion, NoDirectLogin, Persistent, LockedOut
diff --git a/bin/config-include/StandaloneHypergrid.ini b/bin/config-include/StandaloneHypergrid.ini
index 68aa739..486f22e 100644
--- a/bin/config-include/StandaloneHypergrid.ini
+++ b/bin/config-include/StandaloneHypergrid.ini
@@ -65,12 +65,15 @@
65 LocalServiceModule = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService" 65 LocalServiceModule = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"
66 66
67[GridService] 67[GridService]
68 ; LocalGridServicesConnector needs this 68 ; LocalGridServicesConnector needs this
69 LocalServiceModule = "OpenSim.Services.GridService.dll:GridService" 69 LocalServiceModule = "OpenSim.Services.GridService.dll:GridService"
70 Realm = "regions" 70 Realm = "regions"
71 StorageProvider = "OpenSim.Data.Null.dll" 71 StorageProvider = "OpenSim.Data.Null.dll"
72 72
73 AllowHypergridMapSearch = true 73 ; Needed to display non-default map tile images for remote regions
74 AssetService = "OpenSim.Services.AssetService.dll:AssetService"
75
76 AllowHypergridMapSearch = true
74 77
75[PresenceService] 78[PresenceService]
76 LocalServiceModule = "OpenSim.Services.PresenceService.dll:PresenceService" 79 LocalServiceModule = "OpenSim.Services.PresenceService.dll:PresenceService"