aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2014-09-26 01:02:19 +0100
committerJustin Clark-Casey (justincc)2014-09-26 01:02:19 +0100
commit9fcee7332638a8008140b77641a957ec9268e828 (patch)
tree10f9397ddb6ef8faf35446819284ada20fea65d0 /OpenSim/Region/CoreModules/World
parentAdd "debug lludp data out" console command for logging outgoing data just bef... (diff)
downloadopensim-SC-9fcee7332638a8008140b77641a957ec9268e828.zip
opensim-SC-9fcee7332638a8008140b77641a957ec9268e828.tar.gz
opensim-SC-9fcee7332638a8008140b77641a957ec9268e828.tar.bz2
opensim-SC-9fcee7332638a8008140b77641a957ec9268e828.tar.xz
Make "generate map" console command also trigger upload to maptiles as well as asset generation without performing tile generation twice.
Diffstat (limited to 'OpenSim/Region/CoreModules/World')
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs44
1 files changed, 34 insertions, 10 deletions
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index 3af8ac4..78fbefe 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -68,6 +68,9 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
68 private static readonly UUID STOP_UUID = UUID.Random(); 68 private static readonly UUID STOP_UUID = UUID.Random();
69 private static readonly string m_mapLayerPath = "0001/"; 69 private static readonly string m_mapLayerPath = "0001/";
70 70
71 private IMapImageGenerator m_mapImageGenerator;
72 private IMapImageUploadModule m_mapImageServiceModule;
73
71 private OpenSim.Framework.BlockingQueue<MapRequestState> requests = new OpenSim.Framework.BlockingQueue<MapRequestState>(); 74 private OpenSim.Framework.BlockingQueue<MapRequestState> requests = new OpenSim.Framework.BlockingQueue<MapRequestState>();
72 75
73 protected Scene m_scene; 76 protected Scene m_scene;
@@ -100,7 +103,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
100 = Util.GetConfigVarFromSections<int>(config, "BlacklistTimeout", configSections, 10 * 60) * 1000; 103 = Util.GetConfigVarFromSections<int>(config, "BlacklistTimeout", configSections, 10 * 60) * 1000;
101 } 104 }
102 105
103 public virtual void AddRegion (Scene scene) 106 public virtual void AddRegion(Scene scene)
104 { 107 {
105 if (!m_Enabled) 108 if (!m_Enabled)
106 return; 109 return;
@@ -144,8 +147,10 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
144 return; 147 return;
145 148
146 m_ServiceThrottle = scene.RequestModuleInterface<IServiceThrottleModule>(); 149 m_ServiceThrottle = scene.RequestModuleInterface<IServiceThrottleModule>();
147 }
148 150
151 m_mapImageGenerator = m_scene.RequestModuleInterface<IMapImageGenerator>();
152 m_mapImageServiceModule = m_scene.RequestModuleInterface<IMapImageUploadModule>();
153 }
149 154
150 public virtual void Close() 155 public virtual void Close()
151 { 156 {
@@ -1315,7 +1320,17 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1315 if (consoleScene != null && consoleScene != m_scene) 1320 if (consoleScene != null && consoleScene != m_scene)
1316 return; 1321 return;
1317 1322
1318 GenerateMaptile(); 1323 if (m_mapImageGenerator == null)
1324 {
1325 Console.WriteLine("No map image generator available for {0}", m_scene.Name);
1326 return;
1327 }
1328
1329 using (Bitmap mapbmp = m_mapImageGenerator.CreateMapTile())
1330 {
1331 GenerateMaptile(mapbmp);
1332 m_mapImageServiceModule.UploadMapTile(m_scene, mapbmp);
1333 }
1319 } 1334 }
1320 1335
1321 public OSD HandleRemoteMapItemRequest(string path, OSD request, string endpoint) 1336 public OSD HandleRemoteMapItemRequest(string path, OSD request, string endpoint)
@@ -1444,16 +1459,25 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1444 if (m_scene.Heightmap == null) 1459 if (m_scene.Heightmap == null)
1445 return; 1460 return;
1446 1461
1447 //create a texture asset of the terrain 1462 m_log.DebugFormat("[WORLD MAP]: Generating map image for {0}", m_scene.Name);
1448 IMapImageGenerator terrain = m_scene.RequestModuleInterface<IMapImageGenerator>();
1449 if (terrain == null)
1450 return;
1451 1463
1452 m_log.DebugFormat("[WORLD MAP]: Generating map image for {0}", m_scene.RegionInfo.RegionName); 1464 using (Bitmap mapbmp = m_mapImageGenerator.CreateMapTile())
1465 GenerateMaptile(mapbmp);
1466 }
1453 1467
1454 byte[] data = terrain.WriteJpeg2000Image(); 1468 private void GenerateMaptile(Bitmap mapbmp)
1455 if (data == null) 1469 {
1470 byte[] data;
1471
1472 try
1473 {
1474 data = OpenJPEG.EncodeFromImage(mapbmp, true);
1475 }
1476 catch (Exception e) // LEGIT: Catching problems caused by OpenJPEG p/invoke
1477 {
1478 m_log.Error("[WORLD MAP]: Failed generating terrain map: " + e);
1456 return; 1479 return;
1480 }
1457 1481
1458 byte[] overlay = GenerateOverlay(); 1482 byte[] overlay = GenerateOverlay();
1459 1483