diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index ce2b856322..eb09de3809 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs @@ -688,6 +688,20 @@ namespace OpenSim break; + case "export-map": + if (m_sceneManager.CurrentScene != null) + { + if (cmdparams.Length > 0) + { + m_sceneManager.CurrentScene.ExportWorldMap(cmdparams[0]); + } + else + { + m_sceneManager.CurrentScene.ExportWorldMap("exportmap.jpg"); + } + } + break; + default: m_log.Error("Unknown command"); break; diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 1400e609e5..bc4fa3c8d4 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -470,6 +470,48 @@ namespace OpenSim.Region.Environment.Scenes #region Load Terrain + public void ExportWorldMap(string fileName) + { + List mapBlocks = this.CommsManager.GridService.RequestNeighbourMapBlocks((int)(this.RegionInfo.RegionLocX - 9), (int)(this.RegionInfo.RegionLocY - 9), (int)(this.RegionInfo.RegionLocX + 9), (int)(this.RegionInfo.RegionLocY + 9)); + List textures = new List(); + List bitImages = new List(); + + foreach (MapBlockData mapBlock in mapBlocks) + { + AssetBase texAsset = this.AssetCache.GetAsset(mapBlock.MapImageId, true); + + if (texAsset != null) + { + textures.Add(texAsset); + } + else + { + texAsset = this.AssetCache.GetAsset(mapBlock.MapImageId, true); + if (texAsset != null) + { + textures.Add(texAsset); + } + } + } + + foreach(AssetBase asset in textures) + { + System.Drawing.Image image= OpenJPEGNet.OpenJPEG.DecodeToImage(asset.Data); + bitImages.Add(image); + } + + System.Drawing.Bitmap mapTexture = new System.Drawing.Bitmap(2560, 2560); + System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(mapTexture); + + for(int i =0; i /// Loads the World heightmap ///