diff options
author | onefang | 2019-08-22 12:01:47 +1000 |
---|---|---|
committer | onefang | 2019-08-22 12:01:47 +1000 |
commit | fe8977564bda8ec2f328ebb2d2623c43073e9be5 (patch) | |
tree | 3bd04d2a64dcd8d141c5f4221c581fa215c2c3ad | |
parent | OhSillyThreatLevels should throw an exception when not allowed. (diff) | |
download | opensim-SC-fe8977564bda8ec2f328ebb2d2623c43073e9be5.zip opensim-SC-fe8977564bda8ec2f328ebb2d2623c43073e9be5.tar.gz opensim-SC-fe8977564bda8ec2f328ebb2d2623c43073e9be5.tar.bz2 opensim-SC-fe8977564bda8ec2f328ebb2d2623c43073e9be5.tar.xz |
When the generate map command is given, generate the map.
The month check seems a bit dodgy, but I'll let it ride for now.
4 files changed, 40 insertions, 2 deletions
diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs index b927cfa..1e63662 100644 --- a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs +++ b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs | |||
@@ -73,6 +73,10 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
73 | 73 | ||
74 | #region IMapImageGenerator Members | 74 | #region IMapImageGenerator Members |
75 | 75 | ||
76 | public Bitmap CreateMapTileForce() | ||
77 | { | ||
78 | return CreateMapTile(); | ||
79 | } | ||
76 | public Bitmap CreateMapTile() | 80 | public Bitmap CreateMapTile() |
77 | { | 81 | { |
78 | bool drawPrimVolume = true; | 82 | bool drawPrimVolume = true; |
diff --git a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs index fb94853..d094bee 100644 --- a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs +++ b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs | |||
@@ -245,10 +245,20 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
245 | g.Flush(); | 245 | g.Flush(); |
246 | } | 246 | } |
247 | */ | 247 | */ |
248 | public Bitmap CreateMapTileForce() | ||
249 | { | ||
250 | m_log.Info("[MAPTILE]: Forcing a map tile regenerate."); | ||
251 | File.Delete(System.IO.Path.Combine(m_cacheDirectory, m_scene.RegionInfo.RegionID + ".bmp")); | ||
252 | return CreateMapTile(); | ||
253 | } | ||
248 | public Bitmap CreateMapTile() | 254 | public Bitmap CreateMapTile() |
249 | { | 255 | { |
250 | if ((File.GetCreationTime(System.IO.Path.Combine(m_cacheDirectory, m_scene.RegionInfo.RegionID + ".bmp")).Month != DateTime.Now.Month) && m_enable_refreshEveryMonth == true) | 256 | if ((File.GetCreationTime(System.IO.Path.Combine(m_cacheDirectory, m_scene.RegionInfo.RegionID + ".bmp")).Month != DateTime.Now.Month) && (m_enable_refreshEveryMonth == true)) |
257 | { | ||
258 | m_log.InfoFormat("[MAPTILE]: Clearing old map tile out of cache {0} {1}.", | ||
259 | File.GetCreationTime(System.IO.Path.Combine(m_cacheDirectory, m_scene.RegionInfo.RegionID + ".bmp")).Month, DateTime.Now.Month); | ||
251 | File.Delete(System.IO.Path.Combine(m_cacheDirectory, m_scene.RegionInfo.RegionID + ".bmp")); | 260 | File.Delete(System.IO.Path.Combine(m_cacheDirectory, m_scene.RegionInfo.RegionID + ".bmp")); |
261 | } | ||
252 | 262 | ||
253 | if(File.Exists(System.IO.Path.Combine(m_cacheDirectory, m_scene.RegionInfo.RegionID + ".bmp"))) | 263 | if(File.Exists(System.IO.Path.Combine(m_cacheDirectory, m_scene.RegionInfo.RegionID + ".bmp"))) |
254 | { | 264 | { |
@@ -256,6 +266,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
256 | } | 266 | } |
257 | else | 267 | else |
258 | { | 268 | { |
269 | m_log.Info("[MAPTILE]: Actually generating a map tile."); | ||
259 | /* this must be on all map, not just its image | 270 | /* this must be on all map, not just its image |
260 | if ((DateTime.Now - lastImageTime).TotalSeconds < 3600) | 271 | if ((DateTime.Now - lastImageTime).TotalSeconds < 3600) |
261 | { | 272 | { |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 03a4d34..94072a5 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | |||
@@ -1458,7 +1458,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1458 | if (consoleScene != null && consoleScene != m_scene) | 1458 | if (consoleScene != null && consoleScene != m_scene) |
1459 | return; | 1459 | return; |
1460 | 1460 | ||
1461 | GenerateMaptile(); | 1461 | GenerateMaptileForce(); |
1462 | } | 1462 | } |
1463 | 1463 | ||
1464 | public OSD HandleRemoteMapItemRequest(string path, OSD request, string endpoint) | 1464 | public OSD HandleRemoteMapItemRequest(string path, OSD request, string endpoint) |
@@ -1572,6 +1572,28 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1572 | return responsemap; | 1572 | return responsemap; |
1573 | } | 1573 | } |
1574 | 1574 | ||
1575 | private void GenerateMaptileForce() | ||
1576 | { | ||
1577 | // Cannot create a map for a nonexistent heightmap | ||
1578 | if (m_scene.Heightmap == null) | ||
1579 | return; | ||
1580 | |||
1581 | if (m_mapImageGenerator == null) | ||
1582 | { | ||
1583 | Console.WriteLine("No map image generator available for {0}", m_scene.Name); | ||
1584 | return; | ||
1585 | } | ||
1586 | m_log.DebugFormat("[WORLD MAP]: Generating map image for {0}", m_scene.Name); | ||
1587 | |||
1588 | using (Bitmap mapbmp = m_mapImageGenerator.CreateMapTileForce()) | ||
1589 | { | ||
1590 | GenerateMaptile(mapbmp); | ||
1591 | |||
1592 | if (m_mapImageServiceModule != null) | ||
1593 | m_mapImageServiceModule.UploadMapTile(m_scene, mapbmp); | ||
1594 | } | ||
1595 | } | ||
1596 | |||
1575 | public void GenerateMaptile() | 1597 | public void GenerateMaptile() |
1576 | { | 1598 | { |
1577 | // Cannot create a map for a nonexistent heightmap | 1599 | // Cannot create a map for a nonexistent heightmap |
diff --git a/OpenSim/Region/Framework/Interfaces/ITerrain.cs b/OpenSim/Region/Framework/Interfaces/ITerrain.cs index 815a2d8..2fc954a 100644 --- a/OpenSim/Region/Framework/Interfaces/ITerrain.cs +++ b/OpenSim/Region/Framework/Interfaces/ITerrain.cs | |||
@@ -74,6 +74,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
74 | 74 | ||
75 | public interface IMapImageGenerator | 75 | public interface IMapImageGenerator |
76 | { | 76 | { |
77 | System.Drawing.Bitmap CreateMapTileForce(); | ||
77 | System.Drawing.Bitmap CreateMapTile(); | 78 | System.Drawing.Bitmap CreateMapTile(); |
78 | System.Drawing.Bitmap CreateViewImage(Vector3 camPos, Vector3 camDir, float fov, int width, int height, bool useTextures); | 79 | System.Drawing.Bitmap CreateViewImage(Vector3 camPos, Vector3 camDir, float fov, int width, int height, bool useTextures); |
79 | byte[] WriteJpeg2000Image(); | 80 | byte[] WriteJpeg2000Image(); |