- Moved WorldMapModule and HGWorldMapModule to the new region-module system
- Cleaned up some whitespace0.6.5-rc1
parent
2246b4daaa
commit
6a08accde0
|
@ -37,30 +37,51 @@ using OpenSim.Region.Framework.Scenes;
|
||||||
|
|
||||||
namespace OpenSim.Region.CoreModules.Hypergrid
|
namespace OpenSim.Region.CoreModules.Hypergrid
|
||||||
{
|
{
|
||||||
public class HGWorldMapModule : WorldMapModule, IRegionModule
|
public class HGWorldMapModule : WorldMapModule
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log =
|
private static readonly ILog m_log =
|
||||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
#region IRegionModule Members
|
#region INonSharedRegionModule Members
|
||||||
|
|
||||||
public override void Initialise(Scene scene, IConfigSource config)
|
public override void Initialise(IConfigSource config)
|
||||||
{
|
{
|
||||||
IConfig startupConfig = config.Configs["Startup"];
|
IConfig startupConfig = config.Configs["Startup"];
|
||||||
if (startupConfig.GetString("WorldMapModule", "WorldMap") == "HGWorldMap")
|
if (startupConfig.GetString("WorldMapModule", "WorldMap") == "HGWorldMap")
|
||||||
m_Enabled = true;
|
m_Enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void AddRegion(Scene scene)
|
||||||
|
{
|
||||||
if (!m_Enabled)
|
if (!m_Enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_log.Info("[HGMap] Initializing...");
|
m_log.Info("[HGMap] Initializing...");
|
||||||
m_scene = scene;
|
lock (scene)
|
||||||
|
{
|
||||||
|
m_scene = scene;
|
||||||
|
|
||||||
m_scene.RegisterModuleInterface<IWorldMapModule>(this);
|
m_scene.RegisterModuleInterface<IWorldMapModule>(this);
|
||||||
|
|
||||||
m_scene.AddCommand(
|
m_scene.AddCommand(
|
||||||
this, "export-map",
|
this, "export-map",
|
||||||
"export-map [<path>]",
|
"export-map [<path>]",
|
||||||
"Save an image of the world map", HandleExportWorldMapConsoleCommand);
|
"Save an image of the world map", HandleExportWorldMapConsoleCommand);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void RemoveRegion(Scene scene)
|
||||||
|
{
|
||||||
|
if (!m_Enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
lock (m_scene)
|
||||||
|
{
|
||||||
|
m_Enabled = false;
|
||||||
|
m_scene.UnregisterModuleInterface<IWorldMapModule>(this);
|
||||||
|
// TODO: m_scene.RemoveCommand(this, "export-map");
|
||||||
|
m_scene = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string Name
|
public override string Name
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
|
|
||||||
<Extension path = "/OpenSim/RegionModules">
|
<Extension path = "/OpenSim/RegionModules">
|
||||||
<RegionModule id="TerrainModule" type="OpenSim.Region.CoreModules.World.Terrain.TerrainModule" />
|
<RegionModule id="TerrainModule" type="OpenSim.Region.CoreModules.World.Terrain.TerrainModule" />
|
||||||
|
<RegionModule id="WorldMapModule" type="OpenSim.Region.CoreModules.World.WorldMap.WorldMapModule" />
|
||||||
|
<RegionModule id="HGWorldMapModule" type="OpenSim.Region.CoreModules.Hypergrid.HGWorldMapModule" />
|
||||||
</Extension>
|
</Extension>
|
||||||
|
|
||||||
<Extension path = "/OpenSim/WindModule">
|
<Extension path = "/OpenSim/WindModule">
|
||||||
|
|
|
@ -50,7 +50,7 @@ using OSDMap=OpenMetaverse.StructuredData.OSDMap;
|
||||||
|
|
||||||
namespace OpenSim.Region.CoreModules.World.WorldMap
|
namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||||
{
|
{
|
||||||
public class WorldMapModule : IRegionModule, IWorldMapModule
|
public class WorldMapModule : INonSharedRegionModule, IWorldMapModule
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log =
|
private static readonly ILog m_log =
|
||||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
@ -66,7 +66,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||||
private List<MapBlockData> cachedMapBlocks = new List<MapBlockData>();
|
private List<MapBlockData> cachedMapBlocks = new List<MapBlockData>();
|
||||||
private int cachedTime = 0;
|
private int cachedTime = 0;
|
||||||
private byte[] myMapImageJPEG;
|
private byte[] myMapImageJPEG;
|
||||||
protected bool m_Enabled = false;
|
protected volatile bool m_Enabled = false;
|
||||||
private Dictionary<UUID, MapRequestState> m_openRequests = new Dictionary<UUID, MapRequestState>();
|
private Dictionary<UUID, MapRequestState> m_openRequests = new Dictionary<UUID, MapRequestState>();
|
||||||
private Dictionary<string, int> m_blacklistedurls = new Dictionary<string, int>();
|
private Dictionary<string, int> m_blacklistedurls = new Dictionary<string, int>();
|
||||||
private Dictionary<ulong, int> m_blacklistedregions = new Dictionary<ulong, int>();
|
private Dictionary<ulong, int> m_blacklistedregions = new Dictionary<ulong, int>();
|
||||||
|
@ -77,33 +77,52 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||||
|
|
||||||
//private int CacheRegionsDistance = 256;
|
//private int CacheRegionsDistance = 256;
|
||||||
|
|
||||||
#region IRegionModule Members
|
#region INonSharedRegionModule Members
|
||||||
|
public virtual void Initialise (IConfigSource config)
|
||||||
public virtual void Initialise(Scene scene, IConfigSource config)
|
|
||||||
{
|
{
|
||||||
IConfig startupConfig = config.Configs["Startup"];
|
IConfig startupConfig = config.Configs["Startup"];
|
||||||
if (startupConfig.GetString("WorldMapModule", "WorldMap") == "WorldMap")
|
if (startupConfig.GetString("WorldMapModule", "WorldMap") == "WorldMap")
|
||||||
m_Enabled = true;
|
m_Enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void AddRegion (Scene scene)
|
||||||
|
{
|
||||||
if (!m_Enabled)
|
if (!m_Enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_scene = scene;
|
lock (scene)
|
||||||
|
{
|
||||||
|
m_scene = scene;
|
||||||
|
|
||||||
m_scene.RegisterModuleInterface<IWorldMapModule>(this);
|
m_scene.RegisterModuleInterface<IWorldMapModule>(this);
|
||||||
|
|
||||||
m_scene.AddCommand(
|
m_scene.AddCommand(
|
||||||
this, "export-map",
|
this, "export-map",
|
||||||
"export-map [<path>]",
|
"export-map [<path>]",
|
||||||
"Save an image of the world map", HandleExportWorldMapConsoleCommand);
|
"Save an image of the world map", HandleExportWorldMapConsoleCommand);
|
||||||
}
|
|
||||||
|
|
||||||
public virtual void PostInitialise()
|
|
||||||
{
|
|
||||||
if (m_Enabled)
|
|
||||||
AddHandlers();
|
AddHandlers();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual void RemoveRegion (Scene scene)
|
||||||
|
{
|
||||||
|
if (!m_Enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
lock (m_scene)
|
||||||
|
{
|
||||||
|
m_Enabled = false;
|
||||||
|
RemoveHandlers();
|
||||||
|
m_scene = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void RegionLoaded (Scene scene)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public virtual void Close()
|
public virtual void Close()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -113,13 +132,9 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||||
get { return "WorldMapModule"; }
|
get { return "WorldMapModule"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsSharedModule
|
|
||||||
{
|
|
||||||
get { return false; }
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
// this has to be called with a lock on m_scene
|
||||||
protected virtual void AddHandlers()
|
protected virtual void AddHandlers()
|
||||||
{
|
{
|
||||||
myMapImageJPEG = new byte[0];
|
myMapImageJPEG = new byte[0];
|
||||||
|
@ -139,6 +154,22 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||||
m_scene.EventManager.OnMakeRootAgent += MakeRootAgent;
|
m_scene.EventManager.OnMakeRootAgent += MakeRootAgent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// this has to be called with a lock on m_scene
|
||||||
|
protected virtual void RemoveHandlers()
|
||||||
|
{
|
||||||
|
m_scene.EventManager.OnMakeRootAgent -= MakeRootAgent;
|
||||||
|
m_scene.EventManager.OnMakeChildAgent -= MakeChildAgent;
|
||||||
|
m_scene.EventManager.OnClientClosed -= ClientLoggedOut;
|
||||||
|
m_scene.EventManager.OnNewClient -= OnNewClient;
|
||||||
|
m_scene.EventManager.OnRegisterCaps -= OnRegisterCaps;
|
||||||
|
|
||||||
|
string regionimage = "regionImage" + m_scene.RegionInfo.RegionID.ToString();
|
||||||
|
regionimage = regionimage.Replace("-", "");
|
||||||
|
m_scene.CommsManager.HttpServer.RemoveLLSDHandler("/MAP/MapItems/" + m_scene.RegionInfo.RegionHandle.ToString(),
|
||||||
|
HandleRemoteMapItemRequest);
|
||||||
|
m_scene.CommsManager.HttpServer.RemoveHTTPHandler("", regionimage);
|
||||||
|
}
|
||||||
|
|
||||||
public void OnRegisterCaps(UUID agentID, Caps caps)
|
public void OnRegisterCaps(UUID agentID, Caps caps)
|
||||||
{
|
{
|
||||||
//m_log.DebugFormat("[WORLD MAP]: OnRegisterCaps: agentID {0} caps {1}", agentID, caps);
|
//m_log.DebugFormat("[WORLD MAP]: OnRegisterCaps: agentID {0} caps {1}", agentID, caps);
|
||||||
|
@ -1036,6 +1067,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct MapRequestState
|
public struct MapRequestState
|
||||||
|
|
Loading…
Reference in New Issue