diff options
author | UbitUmarov | 2015-08-22 16:35:49 +0100 |
---|---|---|
committer | UbitUmarov | 2015-08-22 16:35:49 +0100 |
commit | 5da99790241a38d63d7b4f765bb8ad4b4b024546 (patch) | |
tree | 5b09223c62fa24e2869e4276e2648c1e467fd89b /OpenSim/Region/CoreModules/World/WorldMap | |
parent | update MapSearchModule (diff) | |
download | opensim-SC_OLD-5da99790241a38d63d7b4f765bb8ad4b4b024546.zip opensim-SC_OLD-5da99790241a38d63d7b4f765bb8ad4b4b024546.tar.gz opensim-SC_OLD-5da99790241a38d63d7b4f765bb8ad4b4b024546.tar.bz2 opensim-SC_OLD-5da99790241a38d63d7b4f765bb8ad4b4b024546.tar.xz |
Warp3D map now seems to work
Diffstat (limited to 'OpenSim/Region/CoreModules/World/WorldMap')
-rw-r--r-- | OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | 51 |
1 files changed, 42 insertions, 9 deletions
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 31b1c35..9a6ee99 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | |||
@@ -72,6 +72,9 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
72 | private ManualResetEvent m_mapBlockRequestEvent = new ManualResetEvent(false); | 72 | private ManualResetEvent m_mapBlockRequestEvent = new ManualResetEvent(false); |
73 | private Dictionary<UUID, Queue<MapBlockRequestData>> m_mapBlockRequests = new Dictionary<UUID, Queue<MapBlockRequestData>>(); | 73 | private Dictionary<UUID, Queue<MapBlockRequestData>> m_mapBlockRequests = new Dictionary<UUID, Queue<MapBlockRequestData>>(); |
74 | 74 | ||
75 | private IMapImageGenerator m_mapImageGenerator; | ||
76 | private IMapTileModule m_mapImageServiceModule; | ||
77 | |||
75 | protected Scene m_scene; | 78 | protected Scene m_scene; |
76 | private List<MapBlockData> cachedMapBlocks = new List<MapBlockData>(); | 79 | private List<MapBlockData> cachedMapBlocks = new List<MapBlockData>(); |
77 | private int cachedTime = 0; | 80 | private int cachedTime = 0; |
@@ -139,6 +142,11 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
139 | 142 | ||
140 | public virtual void RegionLoaded (Scene scene) | 143 | public virtual void RegionLoaded (Scene scene) |
141 | { | 144 | { |
145 | if (!m_Enabled) | ||
146 | return; | ||
147 | |||
148 | m_mapImageGenerator = m_scene.RequestModuleInterface<IMapImageGenerator>(); | ||
149 | m_mapImageServiceModule = m_scene.RequestModuleInterface<IMapTileModule>(); | ||
142 | } | 150 | } |
143 | 151 | ||
144 | 152 | ||
@@ -1391,7 +1399,17 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1391 | if (consoleScene != null && consoleScene != m_scene) | 1399 | if (consoleScene != null && consoleScene != m_scene) |
1392 | return; | 1400 | return; |
1393 | 1401 | ||
1394 | GenerateMaptile(); | 1402 | if (m_mapImageGenerator == null) |
1403 | { | ||
1404 | Console.WriteLine("No map image generator available for {0}", m_scene.Name); | ||
1405 | return; | ||
1406 | } | ||
1407 | |||
1408 | using (Bitmap mapbmp = m_mapImageGenerator.CreateMapTile()) | ||
1409 | { | ||
1410 | GenerateMaptile(mapbmp); | ||
1411 | // m_mapImageServiceModule.UploadMapTile(m_scene, mapbmp); | ||
1412 | } | ||
1395 | } | 1413 | } |
1396 | 1414 | ||
1397 | public OSD HandleRemoteMapItemRequest(string path, OSD request, string endpoint) | 1415 | public OSD HandleRemoteMapItemRequest(string path, OSD request, string endpoint) |
@@ -1514,20 +1532,35 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1514 | 1532 | ||
1515 | public void GenerateMaptile() | 1533 | public void GenerateMaptile() |
1516 | { | 1534 | { |
1517 | // Cannot create a map for a nonexistant heightmap | 1535 | // Cannot create a map for a nonexistent heightmap |
1518 | if (m_scene.Heightmap == null) | 1536 | if (m_scene.Heightmap == null) |
1519 | return; | 1537 | return; |
1520 | 1538 | ||
1521 | //create a texture asset of the terrain | 1539 | m_log.DebugFormat("[WORLD MAP]: Generating map image for {0}", m_scene.Name); |
1522 | IMapImageGenerator terrain = m_scene.RequestModuleInterface<IMapImageGenerator>(); | ||
1523 | if (terrain == null) | ||
1524 | return; | ||
1525 | 1540 | ||
1526 | m_log.DebugFormat("[WORLD MAP]: Generating map image for {0}", m_scene.RegionInfo.RegionName); | 1541 | using (Bitmap mapbmp = m_mapImageGenerator.CreateMapTile()) |
1542 | { | ||
1543 | // V1 (This Module) | ||
1544 | GenerateMaptile(mapbmp); | ||
1545 | |||
1546 | // v2/3 (MapImageServiceModule) | ||
1547 | m_mapImageServiceModule.UploadMapTile(m_scene, mapbmp); | ||
1548 | } | ||
1549 | } | ||
1550 | |||
1551 | private void GenerateMaptile(Bitmap mapbmp) | ||
1552 | { | ||
1553 | byte[] data; | ||
1527 | 1554 | ||
1528 | byte[] data = terrain.WriteJpeg2000Image(); | 1555 | try |
1529 | if (data == null) | 1556 | { |
1557 | data = OpenJPEG.EncodeFromImage(mapbmp, true); | ||
1558 | } | ||
1559 | catch (Exception e) // LEGIT: Catching problems caused by OpenJPEG p/invoke | ||
1560 | { | ||
1561 | m_log.Error("[WORLD MAP]: Failed generating terrain map: " + e); | ||
1530 | return; | 1562 | return; |
1563 | } | ||
1531 | 1564 | ||
1532 | byte[] overlay = GenerateOverlay(); | 1565 | byte[] overlay = GenerateOverlay(); |
1533 | 1566 | ||