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.cs77
1 files changed, 0 insertions, 77 deletions
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
index 6043b70..bd35c6f 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
@@ -423,83 +423,6 @@ namespace OpenSim.Services.Connectors.SimianGrid
423 423
424 #endregion IGridService 424 #endregion IGridService
425 425
426 private void UploadMapTile(IScene scene)
427 {
428 string errorMessage = null;
429
430 // Create a PNG map tile and upload it to the AddMapTile API
431 byte[] pngData = Utils.EmptyBytes;
432 IMapImageGenerator tileGenerator = scene.RequestModuleInterface<IMapImageGenerator>();
433 if (tileGenerator == null)
434 {
435 m_log.Warn("[SIMIAN GRID CONNECTOR]: Cannot upload PNG map tile without an IMapImageGenerator");
436 return;
437 }
438
439 using (Image mapTile = tileGenerator.CreateMapTile())
440 {
441 using (MemoryStream stream = new MemoryStream())
442 {
443 mapTile.Save(stream, ImageFormat.Png);
444 pngData = stream.ToArray();
445 }
446 }
447
448 List<MultipartForm.Element> postParameters = new List<MultipartForm.Element>()
449 {
450 new MultipartForm.Parameter("X", scene.RegionInfo.RegionLocX.ToString()),
451 new MultipartForm.Parameter("Y", scene.RegionInfo.RegionLocY.ToString()),
452 new MultipartForm.File("Tile", "tile.png", "image/png", pngData)
453 };
454
455 // Make the remote storage request
456 try
457 {
458 HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(m_ServerURI);
459
460 HttpWebResponse response = MultipartForm.Post(request, postParameters);
461 using (Stream responseStream = response.GetResponseStream())
462 {
463 string responseStr = null;
464
465 try
466 {
467 responseStr = responseStream.GetStreamString();
468 OSD responseOSD = OSDParser.Deserialize(responseStr);
469 if (responseOSD.Type == OSDType.Map)
470 {
471 OSDMap responseMap = (OSDMap)responseOSD;
472 if (responseMap["Success"].AsBoolean())
473 m_log.Info("[SIMIAN GRID CONNECTOR]: Uploaded " + pngData.Length + " byte PNG map tile to AddMapTile");
474 else
475 errorMessage = "Upload failed: " + responseMap["Message"].AsString();
476 }
477 else
478 {
479 errorMessage = "Response format was invalid:\n" + responseStr;
480 }
481 }
482 catch (Exception ex)
483 {
484 if (!String.IsNullOrEmpty(responseStr))
485 errorMessage = "Failed to parse the response:\n" + responseStr;
486 else
487 errorMessage = "Failed to retrieve the response: " + ex.Message;
488 }
489 }
490 }
491 catch (WebException ex)
492 {
493 errorMessage = ex.Message;
494 }
495
496 if (!String.IsNullOrEmpty(errorMessage))
497 {
498 m_log.WarnFormat("[SIMIAN GRID CONNECTOR]: Failed to store {0} byte PNG map tile for {1}: {2}",
499 pngData.Length, scene.RegionInfo.RegionName, errorMessage.Replace('\n', ' '));
500 }
501 }
502
503 private GridRegion GetNearestRegion(Vector3d position, bool onlyEnabled) 426 private GridRegion GetNearestRegion(Vector3d position, bool onlyEnabled)
504 { 427 {
505 NameValueCollection requestArgs = new NameValueCollection 428 NameValueCollection requestArgs = new NameValueCollection