mirror of
https://github.com/opensim/opensim.git
synced 2026-08-12 04:05:42 +08:00
* refactor: Move export map function to world map module from scene
This commit is contained in:
@@ -851,15 +851,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
UpdateEvents();
|
||||
|
||||
if (m_frame % m_update_backup == 0)
|
||||
{
|
||||
UpdateStorageBackup();
|
||||
}
|
||||
|
||||
if (m_frame % m_update_terrain == 0)
|
||||
UpdateTerrain();
|
||||
|
||||
if (m_frame % m_update_land == 0)
|
||||
UpdateLand();
|
||||
|
||||
otherMS = Environment.TickCount - otherMS;
|
||||
// if (m_frame%m_update_avatars == 0)
|
||||
// UpdateInWorldTime();
|
||||
@@ -1052,57 +1051,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
#region Load Terrain
|
||||
|
||||
public void ExportWorldMap(string fileName)
|
||||
{
|
||||
List<MapBlockData> mapBlocks =
|
||||
m_sceneGridService.RequestNeighbourMapBlocks((int)(RegionInfo.RegionLocX - 9),
|
||||
(int)(RegionInfo.RegionLocY - 9),
|
||||
(int)(RegionInfo.RegionLocX + 9),
|
||||
(int)(RegionInfo.RegionLocY + 9));
|
||||
List<AssetBase> textures = new List<AssetBase>();
|
||||
List<Image> bitImages = new List<Image>();
|
||||
|
||||
foreach (MapBlockData mapBlock in mapBlocks)
|
||||
{
|
||||
AssetBase texAsset = AssetCache.GetAsset(mapBlock.MapImageId, true);
|
||||
|
||||
if (texAsset != null)
|
||||
{
|
||||
textures.Add(texAsset);
|
||||
}
|
||||
else
|
||||
{
|
||||
texAsset = AssetCache.GetAsset(mapBlock.MapImageId, true);
|
||||
if (texAsset != null)
|
||||
{
|
||||
textures.Add(texAsset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (AssetBase asset in textures)
|
||||
{
|
||||
ManagedImage managedImage;
|
||||
Image image;
|
||||
|
||||
if (OpenJPEG.DecodeToImage(asset.Data, out managedImage, out image))
|
||||
bitImages.Add(image);
|
||||
}
|
||||
|
||||
Bitmap mapTexture = new Bitmap(2560, 2560);
|
||||
Graphics g = Graphics.FromImage(mapTexture);
|
||||
SolidBrush sea = new SolidBrush(Color.DarkBlue);
|
||||
g.FillRectangle(sea, 0, 0, 2560, 2560);
|
||||
|
||||
for (int i = 0; i < mapBlocks.Count; i++)
|
||||
{
|
||||
ushort x = (ushort)((mapBlocks[i].X - RegionInfo.RegionLocX) + 10);
|
||||
ushort y = (ushort)((mapBlocks[i].Y - RegionInfo.RegionLocY) + 10);
|
||||
g.DrawImage(bitImages[i], (x * 128), (y * 128), 128, 128);
|
||||
}
|
||||
mapTexture.Save(fileName, ImageFormat.Jpeg);
|
||||
}
|
||||
|
||||
public void SaveTerrain()
|
||||
{
|
||||
m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID);
|
||||
|
||||
Reference in New Issue
Block a user