aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs')
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs86
1 files changed, 0 insertions, 86 deletions
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
index 9c72a61..18a31670 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
@@ -28,8 +28,6 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Collections.Specialized; 30using System.Collections.Specialized;
31using System.Drawing;
32using System.Drawing.Imaging;
33using System.IO; 31using System.IO;
34using System.Net; 32using System.Net;
35using System.Reflection; 33using System.Reflection;
@@ -102,13 +100,6 @@ namespace OpenSim.Services.Connectors.SimianGrid
102 100
103 public string RegisterRegion(UUID scopeID, GridRegion regionInfo) 101 public string RegisterRegion(UUID scopeID, GridRegion regionInfo)
104 { 102 {
105 // Generate and upload our map tile in PNG format to the SimianGrid AddMapTile service
106// Scene scene;
107// if (m_scenes.TryGetValue(regionInfo.RegionID, out scene))
108// UploadMapTile(scene);
109// else
110// m_log.Warn("Registering region " + regionInfo.RegionName + " (" + regionInfo.RegionID + ") that we are not tracking");
111
112 Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0); 103 Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0);
113 Vector3d maxPosition = minPosition + new Vector3d(Constants.RegionSize, Constants.RegionSize, 4096.0); 104 Vector3d maxPosition = minPosition + new Vector3d(Constants.RegionSize, Constants.RegionSize, 4096.0);
114 105
@@ -380,83 +371,6 @@ namespace OpenSim.Services.Connectors.SimianGrid
380 371
381 #endregion IGridService 372 #endregion IGridService
382 373
383 private void UploadMapTile(IScene scene)
384 {
385 string errorMessage = null;
386
387 // Create a PNG map tile and upload it to the AddMapTile API
388 byte[] pngData = Utils.EmptyBytes;
389 IMapImageGenerator tileGenerator = scene.RequestModuleInterface<IMapImageGenerator>();
390 if (tileGenerator == null)
391 {
392 m_log.Warn("[SIMIAN GRID CONNECTOR]: Cannot upload PNG map tile without an IMapImageGenerator");
393 return;
394 }
395
396 using (Image mapTile = tileGenerator.CreateMapTile())
397 {
398 using (MemoryStream stream = new MemoryStream())
399 {
400 mapTile.Save(stream, ImageFormat.Png);
401 pngData = stream.ToArray();
402 }
403 }
404
405 List<MultipartForm.Element> postParameters = new List<MultipartForm.Element>()
406 {
407 new MultipartForm.Parameter("X", scene.RegionInfo.RegionLocX.ToString()),
408 new MultipartForm.Parameter("Y", scene.RegionInfo.RegionLocY.ToString()),
409 new MultipartForm.File("Tile", "tile.png", "image/png", pngData)
410 };
411
412 // Make the remote storage request
413 try
414 {
415 HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(m_ServerURI);
416
417 HttpWebResponse response = MultipartForm.Post(request, postParameters);
418 using (Stream responseStream = response.GetResponseStream())
419 {
420 string responseStr = null;
421
422 try
423 {
424 responseStr = responseStream.GetStreamString();
425 OSD responseOSD = OSDParser.Deserialize(responseStr);
426 if (responseOSD.Type == OSDType.Map)
427 {
428 OSDMap responseMap = (OSDMap)responseOSD;
429 if (responseMap["Success"].AsBoolean())
430 m_log.Info("[SIMIAN GRID CONNECTOR]: Uploaded " + pngData.Length + " byte PNG map tile to AddMapTile");
431 else
432 errorMessage = "Upload failed: " + responseMap["Message"].AsString();
433 }
434 else
435 {
436 errorMessage = "Response format was invalid:\n" + responseStr;
437 }
438 }
439 catch (Exception ex)
440 {
441 if (!String.IsNullOrEmpty(responseStr))
442 errorMessage = "Failed to parse the response:\n" + responseStr;
443 else
444 errorMessage = "Failed to retrieve the response: " + ex.Message;
445 }
446 }
447 }
448 catch (WebException ex)
449 {
450 errorMessage = ex.Message;
451 }
452
453 if (!String.IsNullOrEmpty(errorMessage))
454 {
455 m_log.WarnFormat("[SIMIAN GRID CONNECTOR]: Failed to store {0} byte PNG map tile for {1}: {2}",
456 pngData.Length, scene.RegionInfo.RegionName, errorMessage.Replace('\n', ' '));
457 }
458 }
459
460 private GridRegion GetNearestRegion(Vector3d position, bool onlyEnabled) 374 private GridRegion GetNearestRegion(Vector3d position, bool onlyEnabled)
461 { 375 {
462 NameValueCollection requestArgs = new NameValueCollection 376 NameValueCollection requestArgs = new NameValueCollection