aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/Connectors
diff options
context:
space:
mode:
authorMelanie2010-12-13 20:19:10 +0000
committerMelanie2010-12-13 20:19:10 +0000
commitd2ff4ebf2d4f30d6ea4a748565d28eacaad363fc (patch)
treef26dfcad312095f3e9d91739f78af08c11bc0f52 /OpenSim/Services/Connectors
parentCorrect Sensor axis for unattached daughter prims. (diff)
parentChanged logging level for message about failure to retrieve a map image from ... (diff)
downloadopensim-SC_OLD-d2ff4ebf2d4f30d6ea4a748565d28eacaad363fc.zip
opensim-SC_OLD-d2ff4ebf2d4f30d6ea4a748565d28eacaad363fc.tar.gz
opensim-SC_OLD-d2ff4ebf2d4f30d6ea4a748565d28eacaad363fc.tar.bz2
opensim-SC_OLD-d2ff4ebf2d4f30d6ea4a748565d28eacaad363fc.tar.xz
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Services/Connectors')
-rw-r--r--OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs31
1 files changed, 16 insertions, 15 deletions
diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
index 85c1380..1ac8478 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.Info("[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)