- Moved WorldMapModule and HGWorldMapModule to the new region-module system
- Cleaned up some whitespace0.6.5-rc1
parent
2246b4daaa
commit
6a08accde0
|
@ -37,22 +37,28 @@ using OpenSim.Region.Framework.Scenes;
|
|||
|
||||
namespace OpenSim.Region.CoreModules.Hypergrid
|
||||
{
|
||||
public class HGWorldMapModule : WorldMapModule, IRegionModule
|
||||
public class HGWorldMapModule : WorldMapModule
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
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"];
|
||||
if (startupConfig.GetString("WorldMapModule", "WorldMap") == "HGWorldMap")
|
||||
m_Enabled = true;
|
||||
}
|
||||
|
||||
public override void AddRegion(Scene scene)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
m_log.Info("[HGMap] Initializing...");
|
||||
lock (scene)
|
||||
{
|
||||
m_scene = scene;
|
||||
|
||||
m_scene.RegisterModuleInterface<IWorldMapModule>(this);
|
||||
|
@ -62,6 +68,21 @@ namespace OpenSim.Region.CoreModules.Hypergrid
|
|||
"export-map [<path>]",
|
||||
"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
|
||||
{
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
<Extension path = "/OpenSim/RegionModules">
|
||||
<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 path = "/OpenSim/WindModule">
|
||||
|
|
|
@ -50,7 +50,7 @@ using OSDMap=OpenMetaverse.StructuredData.OSDMap;
|
|||
|
||||
namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||
{
|
||||
public class WorldMapModule : IRegionModule, IWorldMapModule
|
||||
public class WorldMapModule : INonSharedRegionModule, IWorldMapModule
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
@ -66,7 +66,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
private List<MapBlockData> cachedMapBlocks = new List<MapBlockData>();
|
||||
private int cachedTime = 0;
|
||||
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<string, int> m_blacklistedurls = new Dictionary<string, int>();
|
||||
private Dictionary<ulong, int> m_blacklistedregions = new Dictionary<ulong, int>();
|
||||
|
@ -77,17 +77,21 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
|
||||
//private int CacheRegionsDistance = 256;
|
||||
|
||||
#region IRegionModule Members
|
||||
|
||||
public virtual void Initialise(Scene scene, IConfigSource config)
|
||||
#region INonSharedRegionModule Members
|
||||
public virtual void Initialise (IConfigSource config)
|
||||
{
|
||||
IConfig startupConfig = config.Configs["Startup"];
|
||||
if (startupConfig.GetString("WorldMapModule", "WorldMap") == "WorldMap")
|
||||
m_Enabled = true;
|
||||
}
|
||||
|
||||
public virtual void AddRegion (Scene scene)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
lock (scene)
|
||||
{
|
||||
m_scene = scene;
|
||||
|
||||
m_scene.RegisterModuleInterface<IWorldMapModule>(this);
|
||||
|
@ -96,13 +100,28 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
this, "export-map",
|
||||
"export-map [<path>]",
|
||||
"Save an image of the world map", HandleExportWorldMapConsoleCommand);
|
||||
}
|
||||
|
||||
public virtual void PostInitialise()
|
||||
{
|
||||
if (m_Enabled)
|
||||
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()
|
||||
{
|
||||
|
@ -113,13 +132,9 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
get { return "WorldMapModule"; }
|
||||
}
|
||||
|
||||
public bool IsSharedModule
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
// this has to be called with a lock on m_scene
|
||||
protected virtual void AddHandlers()
|
||||
{
|
||||
myMapImageJPEG = new byte[0];
|
||||
|
@ -139,6 +154,22 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
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)
|
||||
{
|
||||
//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
|
||||
|
|
Loading…
Reference in New Issue