From a859464e91f724816c2ba588a541981469d58d2b Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 23 Jan 2014 23:44:21 +0000 Subject: Add "generate map" console command to allow manual regeneration and storage of maptiles Primarily for test purposes though could be useful if one prefers to manually update the map tile --- .../Region/CoreModules/World/LegacyMap/MapImageModule.cs | 5 ++++- .../Region/CoreModules/World/WorldMap/WorldMapModule.cs | 15 +++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs index 40638f8..61ba5f3 100644 --- a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs +++ b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs @@ -127,7 +127,10 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap try { using (Bitmap mapbmp = CreateMapTile()) - return OpenJPEG.EncodeFromImage(mapbmp, true); + { + if (mapbmp != null) + return OpenJPEG.EncodeFromImage(mapbmp, true); + } } catch (Exception e) // LEGIT: Catching problems caused by OpenJPEG p/invoke { diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index cdf1467..88761a2 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -114,6 +114,11 @@ namespace OpenSim.Region.CoreModules.World.WorldMap "export-map []", "Save an image of the world map", HandleExportWorldMapConsoleCommand); + m_scene.AddCommand( + "Regions", this, "generate map", + "generate map", + "Generates and stores a new maptile.", HandleGenerateMapConsoleCommand); + AddHandlers(); } } @@ -1274,6 +1279,16 @@ namespace OpenSim.Region.CoreModules.World.WorldMap m_scene.RegionInfo.RegionName, exportPath); } + public void HandleGenerateMapConsoleCommand(string module, string[] cmdparams) + { + Scene consoleScene = m_scene.ConsoleScene(); + + if (consoleScene != null && consoleScene != m_scene) + return; + + GenerateMaptile(); + } + public OSD HandleRemoteMapItemRequest(string path, OSD request, string endpoint) { uint xstart = 0; -- cgit v1.1