diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs | 49 |
1 files changed, 33 insertions, 16 deletions
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs index 038a4bf..b031f21 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs | |||
@@ -101,7 +101,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
101 | public string RegisterRegion(UUID scopeID, GridRegion regionInfo) | 101 | public string RegisterRegion(UUID scopeID, GridRegion regionInfo) |
102 | { | 102 | { |
103 | Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0); | 103 | Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0); |
104 | Vector3d maxPosition = minPosition + new Vector3d(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight); | 104 | Vector3d maxPosition = minPosition + new Vector3d(regionInfo.RegionSizeX, regionInfo.RegionSizeY, Constants.RegionHeight); |
105 | 105 | ||
106 | OSDMap extraData = new OSDMap | 106 | OSDMap extraData = new OSDMap |
107 | { | 107 | { |
@@ -129,7 +129,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
129 | { "ExtraData", OSDParser.SerializeJsonString(extraData) } | 129 | { "ExtraData", OSDParser.SerializeJsonString(extraData) } |
130 | }; | 130 | }; |
131 | 131 | ||
132 | OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); | 132 | OSDMap response = SimianGrid.PostToService(m_ServerURI, requestArgs); |
133 | if (response["Success"].AsBoolean()) | 133 | if (response["Success"].AsBoolean()) |
134 | return String.Empty; | 134 | return String.Empty; |
135 | else | 135 | else |
@@ -145,7 +145,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
145 | { "Enabled", "0" } | 145 | { "Enabled", "0" } |
146 | }; | 146 | }; |
147 | 147 | ||
148 | OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); | 148 | OSDMap response = SimianGrid.PostToService(m_ServerURI, requestArgs); |
149 | bool success = response["Success"].AsBoolean(); | 149 | bool success = response["Success"].AsBoolean(); |
150 | 150 | ||
151 | if (!success) | 151 | if (!success) |
@@ -156,15 +156,15 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
156 | 156 | ||
157 | public List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID) | 157 | public List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID) |
158 | { | 158 | { |
159 | const int NEIGHBOR_RADIUS = 128; | ||
160 | |||
161 | GridRegion region = GetRegionByUUID(scopeID, regionID); | 159 | GridRegion region = GetRegionByUUID(scopeID, regionID); |
162 | 160 | ||
161 | int NEIGHBOR_RADIUS = Math.Max(region.RegionSizeX, region.RegionSizeY) / 2; | ||
162 | |||
163 | if (region != null) | 163 | if (region != null) |
164 | { | 164 | { |
165 | List<GridRegion> regions = GetRegionRange(scopeID, | 165 | List<GridRegion> regions = GetRegionRange(scopeID, |
166 | region.RegionLocX - NEIGHBOR_RADIUS, region.RegionLocX + (int)Constants.RegionSize + NEIGHBOR_RADIUS, | 166 | region.RegionLocX - NEIGHBOR_RADIUS, region.RegionLocX + region.RegionSizeX + NEIGHBOR_RADIUS, |
167 | region.RegionLocY - NEIGHBOR_RADIUS, region.RegionLocY + (int)Constants.RegionSize + NEIGHBOR_RADIUS); | 167 | region.RegionLocY - NEIGHBOR_RADIUS, region.RegionLocY + region.RegionSizeY + NEIGHBOR_RADIUS); |
168 | 168 | ||
169 | for (int i = 0; i < regions.Count; i++) | 169 | for (int i = 0; i < regions.Count; i++) |
170 | { | 170 | { |
@@ -192,7 +192,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
192 | 192 | ||
193 | // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request region with uuid {0}",regionID.ToString()); | 193 | // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request region with uuid {0}",regionID.ToString()); |
194 | 194 | ||
195 | OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); | 195 | OSDMap response = SimianGrid.PostToService(m_ServerURI, requestArgs); |
196 | if (response["Success"].AsBoolean()) | 196 | if (response["Success"].AsBoolean()) |
197 | { | 197 | { |
198 | // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] uuid request successful {0}",response["Name"].AsString()); | 198 | // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] uuid request successful {0}",response["Name"].AsString()); |
@@ -220,7 +220,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
220 | 220 | ||
221 | // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request grid at {0}",position.ToString()); | 221 | // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request grid at {0}",position.ToString()); |
222 | 222 | ||
223 | OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); | 223 | OSDMap response = SimianGrid.PostToService(m_ServerURI, requestArgs); |
224 | if (response["Success"].AsBoolean()) | 224 | if (response["Success"].AsBoolean()) |
225 | { | 225 | { |
226 | // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] position request successful {0}",response["Name"].AsString()); | 226 | // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] position request successful {0}",response["Name"].AsString()); |
@@ -229,7 +229,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
229 | else | 229 | else |
230 | { | 230 | { |
231 | // m_log.InfoFormat("[SIMIAN GRID CONNECTOR]: Grid service did not find a match for region at {0},{1}", | 231 | // m_log.InfoFormat("[SIMIAN GRID CONNECTOR]: Grid service did not find a match for region at {0},{1}", |
232 | // x / Constants.RegionSize, y / Constants.RegionSize); | 232 | // Util.WorldToRegionLoc(x), Util.WorldToRegionLoc(y)); |
233 | return null; | 233 | return null; |
234 | } | 234 | } |
235 | } | 235 | } |
@@ -261,7 +261,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
261 | 261 | ||
262 | // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request regions with name {0}",name); | 262 | // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request regions with name {0}",name); |
263 | 263 | ||
264 | OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); | 264 | OSDMap response = SimianGrid.PostToService(m_ServerURI, requestArgs); |
265 | if (response["Success"].AsBoolean()) | 265 | if (response["Success"].AsBoolean()) |
266 | { | 266 | { |
267 | // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] found regions with name {0}",name); | 267 | // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] found regions with name {0}",name); |
@@ -299,7 +299,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
299 | //m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request regions by range {0} to {1}",minPosition.ToString(),maxPosition.ToString()); | 299 | //m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request regions by range {0} to {1}",minPosition.ToString(),maxPosition.ToString()); |
300 | 300 | ||
301 | 301 | ||
302 | OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); | 302 | OSDMap response = SimianGrid.PostToService(m_ServerURI, requestArgs); |
303 | if (response["Success"].AsBoolean()) | 303 | if (response["Success"].AsBoolean()) |
304 | { | 304 | { |
305 | OSDArray array = response["Scenes"] as OSDArray; | 305 | OSDArray array = response["Scenes"] as OSDArray; |
@@ -330,6 +330,12 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
330 | return new List<GridRegion>(0); | 330 | return new List<GridRegion>(0); |
331 | } | 331 | } |
332 | 332 | ||
333 | public List<GridRegion> GetDefaultHypergridRegions(UUID scopeID) | ||
334 | { | ||
335 | // TODO: Allow specifying the default grid location | ||
336 | return GetDefaultRegions(scopeID); | ||
337 | } | ||
338 | |||
333 | public List<GridRegion> GetFallbackRegions(UUID scopeID, int x, int y) | 339 | public List<GridRegion> GetFallbackRegions(UUID scopeID, int x, int y) |
334 | { | 340 | { |
335 | GridRegion defRegion = GetNearestRegion(new Vector3d(x, y, 0.0), true); | 341 | GridRegion defRegion = GetNearestRegion(new Vector3d(x, y, 0.0), true); |
@@ -350,7 +356,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
350 | { "Enabled", "1" } | 356 | { "Enabled", "1" } |
351 | }; | 357 | }; |
352 | 358 | ||
353 | OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); | 359 | OSDMap response = SimianGrid.PostToService(m_ServerURI, requestArgs); |
354 | if (response["Success"].AsBoolean()) | 360 | if (response["Success"].AsBoolean()) |
355 | { | 361 | { |
356 | // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] found regions with name {0}",name); | 362 | // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] found regions with name {0}",name); |
@@ -380,7 +386,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
380 | 386 | ||
381 | m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request region flags for {0}",regionID.ToString()); | 387 | m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request region flags for {0}",regionID.ToString()); |
382 | 388 | ||
383 | OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); | 389 | OSDMap response = SimianGrid.PostToService(m_ServerURI, requestArgs); |
384 | if (response["Success"].AsBoolean()) | 390 | if (response["Success"].AsBoolean()) |
385 | { | 391 | { |
386 | OSDMap extraData = response["ExtraData"] as OSDMap; | 392 | OSDMap extraData = response["ExtraData"] as OSDMap; |
@@ -396,6 +402,13 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
396 | return -1; | 402 | return -1; |
397 | } | 403 | } |
398 | } | 404 | } |
405 | |||
406 | public Dictionary<string, object> GetExtraFeatures() | ||
407 | { | ||
408 | /// See SimulatorFeaturesModule - Need to get map, search and destination guide | ||
409 | Dictionary<string, object> extraFeatures = new Dictionary<string, object>(); | ||
410 | return extraFeatures; | ||
411 | } | ||
399 | 412 | ||
400 | #endregion IGridService | 413 | #endregion IGridService |
401 | 414 | ||
@@ -410,7 +423,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
410 | if (onlyEnabled) | 423 | if (onlyEnabled) |
411 | requestArgs["Enabled"] = "1"; | 424 | requestArgs["Enabled"] = "1"; |
412 | 425 | ||
413 | OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); | 426 | OSDMap response = SimianGrid.PostToService(m_ServerURI, requestArgs); |
414 | if (response["Success"].AsBoolean()) | 427 | if (response["Success"].AsBoolean()) |
415 | { | 428 | { |
416 | return ResponseToGridRegion(response); | 429 | return ResponseToGridRegion(response); |
@@ -437,9 +450,13 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
437 | region.RegionName = response["Name"].AsString(); | 450 | region.RegionName = response["Name"].AsString(); |
438 | 451 | ||
439 | Vector3d minPosition = response["MinPosition"].AsVector3d(); | 452 | Vector3d minPosition = response["MinPosition"].AsVector3d(); |
453 | Vector3d maxPosition = response["MaxPosition"].AsVector3d(); | ||
440 | region.RegionLocX = (int)minPosition.X; | 454 | region.RegionLocX = (int)minPosition.X; |
441 | region.RegionLocY = (int)minPosition.Y; | 455 | region.RegionLocY = (int)minPosition.Y; |
442 | 456 | ||
457 | region.RegionSizeX = (int)maxPosition.X - (int)minPosition.X; | ||
458 | region.RegionSizeY = (int)maxPosition.Y - (int)minPosition.Y; | ||
459 | |||
443 | if ( ! extraData["HyperGrid"] ) { | 460 | if ( ! extraData["HyperGrid"] ) { |
444 | Uri httpAddress = response["Address"].AsUri(); | 461 | Uri httpAddress = response["Address"].AsUri(); |
445 | region.ExternalHostName = httpAddress.Host; | 462 | region.ExternalHostName = httpAddress.Host; |