aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorJustin Clarke Casey2009-02-13 16:43:20 +0000
committerJustin Clarke Casey2009-02-13 16:43:20 +0000
commit88b273bc719b5d462069bdfce5782c5dcaf97596 (patch)
tree6272d4413e1645b52ef8250245186fe88cbb2394 /OpenSim/Region/Framework
parentfixing crash due to make-child and make-root stepping on each other's toes (diff)
downloadopensim-SC_OLD-88b273bc719b5d462069bdfce5782c5dcaf97596.zip
opensim-SC_OLD-88b273bc719b5d462069bdfce5782c5dcaf97596.tar.gz
opensim-SC_OLD-88b273bc719b5d462069bdfce5782c5dcaf97596.tar.bz2
opensim-SC_OLD-88b273bc719b5d462069bdfce5782c5dcaf97596.tar.xz
* refactor: Move export map function to world map module from scene
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs54
1 files changed, 1 insertions, 53 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index ffe0b81..7cce3b6 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -851,15 +851,14 @@ namespace OpenSim.Region.Framework.Scenes
851 UpdateEvents(); 851 UpdateEvents();
852 852
853 if (m_frame % m_update_backup == 0) 853 if (m_frame % m_update_backup == 0)
854 {
855 UpdateStorageBackup(); 854 UpdateStorageBackup();
856 }
857 855
858 if (m_frame % m_update_terrain == 0) 856 if (m_frame % m_update_terrain == 0)
859 UpdateTerrain(); 857 UpdateTerrain();
860 858
861 if (m_frame % m_update_land == 0) 859 if (m_frame % m_update_land == 0)
862 UpdateLand(); 860 UpdateLand();
861
863 otherMS = Environment.TickCount - otherMS; 862 otherMS = Environment.TickCount - otherMS;
864 // if (m_frame%m_update_avatars == 0) 863 // if (m_frame%m_update_avatars == 0)
865 // UpdateInWorldTime(); 864 // UpdateInWorldTime();
@@ -1052,57 +1051,6 @@ namespace OpenSim.Region.Framework.Scenes
1052 1051
1053 #region Load Terrain 1052 #region Load Terrain
1054 1053
1055 public void ExportWorldMap(string fileName)
1056 {
1057 List<MapBlockData> mapBlocks =
1058 m_sceneGridService.RequestNeighbourMapBlocks((int)(RegionInfo.RegionLocX - 9),
1059 (int)(RegionInfo.RegionLocY - 9),
1060 (int)(RegionInfo.RegionLocX + 9),
1061 (int)(RegionInfo.RegionLocY + 9));
1062 List<AssetBase> textures = new List<AssetBase>();
1063 List<Image> bitImages = new List<Image>();
1064
1065 foreach (MapBlockData mapBlock in mapBlocks)
1066 {
1067 AssetBase texAsset = AssetCache.GetAsset(mapBlock.MapImageId, true);
1068
1069 if (texAsset != null)
1070 {
1071 textures.Add(texAsset);
1072 }
1073 else
1074 {
1075 texAsset = AssetCache.GetAsset(mapBlock.MapImageId, true);
1076 if (texAsset != null)
1077 {
1078 textures.Add(texAsset);
1079 }
1080 }
1081 }
1082
1083 foreach (AssetBase asset in textures)
1084 {
1085 ManagedImage managedImage;
1086 Image image;
1087
1088 if (OpenJPEG.DecodeToImage(asset.Data, out managedImage, out image))
1089 bitImages.Add(image);
1090 }
1091
1092 Bitmap mapTexture = new Bitmap(2560, 2560);
1093 Graphics g = Graphics.FromImage(mapTexture);
1094 SolidBrush sea = new SolidBrush(Color.DarkBlue);
1095 g.FillRectangle(sea, 0, 0, 2560, 2560);
1096
1097 for (int i = 0; i < mapBlocks.Count; i++)
1098 {
1099 ushort x = (ushort)((mapBlocks[i].X - RegionInfo.RegionLocX) + 10);
1100 ushort y = (ushort)((mapBlocks[i].Y - RegionInfo.RegionLocY) + 10);
1101 g.DrawImage(bitImages[i], (x * 128), (y * 128), 128, 128);
1102 }
1103 mapTexture.Save(fileName, ImageFormat.Jpeg);
1104 }
1105
1106 public void SaveTerrain() 1054 public void SaveTerrain()
1107 { 1055 {
1108 m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID); 1056 m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID);