mirror of
https://github.com/opensim/opensim.git
synced 2026-08-11 20:05:33 +08:00
First pass at the heart surgery for grid services. Compiles and runs minimally. A few bugs to catch now.
This commit is contained in:
@@ -36,10 +36,12 @@ using OpenSim.Framework;
|
||||
using OpenSim.Framework.Capabilities;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.Physics.Manager;
|
||||
using Caps=OpenSim.Framework.Capabilities.Caps;
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.World.Land
|
||||
{
|
||||
@@ -1301,7 +1303,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
else
|
||||
{
|
||||
// a parcel request for a parcel in another region. Ask the grid about the region
|
||||
RegionInfo info = m_scene.CommsManager.GridService.RequestNeighbourInfo(regionID);
|
||||
GridRegion info = m_scene.GridService.GetRegionByUUID(UUID.Zero, regionID);
|
||||
if (info != null)
|
||||
parcelID = Util.BuildFakeParcelID(info.RegionHandle, x, y);
|
||||
}
|
||||
@@ -1359,9 +1361,10 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
}
|
||||
else
|
||||
{
|
||||
extLandData.landData = m_scene.CommsManager.GridService.RequestLandData(extLandData.regionHandle,
|
||||
extLandData.x,
|
||||
extLandData.y);
|
||||
ILandService landService = m_scene.RequestModuleInterface<ILandService>();
|
||||
extLandData.landData = landService.GetLandData(extLandData.regionHandle,
|
||||
extLandData.x,
|
||||
extLandData.y);
|
||||
if (extLandData.landData == null)
|
||||
{
|
||||
// we didn't find the region/land => don't cache
|
||||
@@ -1373,20 +1376,27 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
|
||||
if (data != null) // if we found some data, send it
|
||||
{
|
||||
RegionInfo info;
|
||||
GridRegion info;
|
||||
if (data.regionHandle == m_scene.RegionInfo.RegionHandle)
|
||||
{
|
||||
info = m_scene.RegionInfo;
|
||||
info = new GridRegion(m_scene.RegionInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
// most likely still cached from building the extLandData entry
|
||||
info = m_scene.CommsManager.GridService.RequestNeighbourInfo(data.regionHandle);
|
||||
uint x = 0, y = 0;
|
||||
Utils.LongToUInts(data.regionHandle, out x, out y);
|
||||
info = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
|
||||
}
|
||||
// we need to transfer the fake parcelID, not the one in landData, so the viewer can match it to the landmark.
|
||||
m_log.DebugFormat("[LAND] got parcelinfo for parcel {0} in region {1}; sending...",
|
||||
data.landData.Name, data.regionHandle);
|
||||
remoteClient.SendParcelInfo(info, data.landData, parcelID, data.x, data.y);
|
||||
// HACK for now
|
||||
RegionInfo r = new RegionInfo();
|
||||
r.RegionName = info.RegionName;
|
||||
r.RegionLocX = (uint)info.RegionLocX;
|
||||
r.RegionLocY = (uint)info.RegionLocY;
|
||||
remoteClient.SendParcelInfo(r, data.landData, parcelID, data.x, data.y);
|
||||
}
|
||||
else
|
||||
m_log.Debug("[LAND] got no parcelinfo; not sending");
|
||||
|
||||
@@ -33,6 +33,8 @@ using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.Framework.Scenes.Hypergrid;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||
{
|
||||
@@ -92,13 +94,13 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||
}
|
||||
|
||||
// try to fetch from GridServer
|
||||
List<RegionInfo> regionInfos = m_scene.SceneGridService.RequestNamedRegions(mapName, 20);
|
||||
List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(UUID.Zero, mapName, 20);
|
||||
if (regionInfos == null)
|
||||
{
|
||||
m_log.Warn("[MAPSEARCHMODULE]: RequestNamedRegions returned null. Old gridserver?");
|
||||
// service wasn't available; maybe still an old GridServer. Try the old API, though it will return only one region
|
||||
regionInfos = new List<RegionInfo>();
|
||||
RegionInfo info = m_scene.SceneGridService.RequestClosestRegion(mapName);
|
||||
regionInfos = new List<GridRegion>();
|
||||
GridRegion info = m_scene.GridService.GetRegionByName(UUID.Zero, mapName);
|
||||
if (info != null) regionInfos.Add(info);
|
||||
}
|
||||
|
||||
@@ -109,11 +111,15 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||
if (mapName.Contains(".") && mapName.Contains(":"))
|
||||
{
|
||||
// It probably is a domain name. Try to link to it.
|
||||
RegionInfo regInfo;
|
||||
GridRegion regInfo;
|
||||
Scene cScene = GetClientScene(remoteClient);
|
||||
regInfo = HGHyperlink.TryLinkRegion(cScene, remoteClient, mapName);
|
||||
if (regInfo != null)
|
||||
regionInfos.Add(regInfo);
|
||||
IHyperlinkService hyperService = cScene.RequestModuleInterface<IHyperlinkService>();
|
||||
if (hyperService != null)
|
||||
{
|
||||
regInfo = hyperService.TryLinkRegion(remoteClient, mapName);
|
||||
if (regInfo != null)
|
||||
regionInfos.Add(regInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,12 +128,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||
MapBlockData data;
|
||||
if (regionInfos.Count > 0)
|
||||
{
|
||||
foreach (RegionInfo info in regionInfos)
|
||||
foreach (GridRegion info in regionInfos)
|
||||
{
|
||||
data = new MapBlockData();
|
||||
data.Agents = 0;
|
||||
data.Access = info.AccessLevel;
|
||||
data.MapImageId = info.RegionSettings.TerrainImageID;
|
||||
data.Access = info.Access;
|
||||
data.MapImageId = info.TerrainImage;
|
||||
data.Name = info.RegionName;
|
||||
data.RegionFlags = 0; // TODO not used?
|
||||
data.WaterHeight = 0; // not used
|
||||
|
||||
@@ -48,6 +48,7 @@ using OpenSim.Region.Framework.Scenes;
|
||||
using Caps=OpenSim.Framework.Capabilities.Caps;
|
||||
using OSDArray=OpenMetaverse.StructuredData.OSDArray;
|
||||
using OSDMap=OpenMetaverse.StructuredData.OSDMap;
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||
{
|
||||
@@ -232,10 +233,20 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||
}
|
||||
if (lookup)
|
||||
{
|
||||
List<MapBlockData> mapBlocks;
|
||||
List<MapBlockData> mapBlocks = new List<MapBlockData>(); ;
|
||||
|
||||
mapBlocks = m_scene.SceneGridService.RequestNeighbourMapBlocks((int)m_scene.RegionInfo.RegionLocX - 8, (int)m_scene.RegionInfo.RegionLocY - 8, (int)m_scene.RegionInfo.RegionLocX + 8, (int)m_scene.RegionInfo.RegionLocY + 8);
|
||||
avatarPresence.ControllingClient.SendMapBlock(mapBlocks,0);
|
||||
List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
|
||||
(int)(m_scene.RegionInfo.RegionLocX - 8) * (int)Constants.RegionSize,
|
||||
(int)(m_scene.RegionInfo.RegionLocY - 8) * (int)Constants.RegionSize,
|
||||
(int)(m_scene.RegionInfo.RegionLocX + 8) * (int)Constants.RegionSize,
|
||||
(int)(m_scene.RegionInfo.RegionLocY + 8) * (int)Constants.RegionSize);
|
||||
foreach (GridRegion r in regions)
|
||||
{
|
||||
MapBlockData block = new MapBlockData();
|
||||
MapBlockFromGridRegion(block, r);
|
||||
mapBlocks.Add(block);
|
||||
}
|
||||
avatarPresence.ControllingClient.SendMapBlock(mapBlocks, 0);
|
||||
|
||||
lock (cachedMapBlocks)
|
||||
cachedMapBlocks = mapBlocks;
|
||||
@@ -579,7 +590,9 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||
}
|
||||
if (httpserver.Length == 0)
|
||||
{
|
||||
RegionInfo mreg = m_scene.SceneGridService.RequestNeighbouringRegionInfo(regionhandle);
|
||||
uint x = 0, y = 0;
|
||||
Utils.LongToUInts(regionhandle, out x, out y);
|
||||
GridRegion mreg = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, (int)x, (int)y);
|
||||
|
||||
if (mreg != null)
|
||||
{
|
||||
@@ -719,15 +732,23 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||
{
|
||||
List<MapBlockData> response = new List<MapBlockData>();
|
||||
|
||||
// this should return one mapblock at most. But make sure: Look whether the one we requested is in there
|
||||
List<MapBlockData> mapBlocks = m_scene.SceneGridService.RequestNeighbourMapBlocks(minX, minY, maxX, maxY);
|
||||
if (mapBlocks != null)
|
||||
// this should return one mapblock at most.
|
||||
// (diva note: why?? in that case we should GetRegionByPosition)
|
||||
// But make sure: Look whether the one we requested is in there
|
||||
List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
|
||||
minX * (int)Constants.RegionSize, minY * (int)Constants.RegionSize,
|
||||
maxX * (int)Constants.RegionSize, maxY * (int)Constants.RegionSize);
|
||||
|
||||
if (regions != null)
|
||||
{
|
||||
foreach (MapBlockData block in mapBlocks)
|
||||
foreach (GridRegion r in regions)
|
||||
{
|
||||
if (block.X == minX && block.Y == minY)
|
||||
if ((r.RegionLocX == minX * (int)Constants.RegionSize) &&
|
||||
(r.RegionLocY == minY * (int)Constants.RegionSize))
|
||||
{
|
||||
// found it => add it to response
|
||||
MapBlockData block = new MapBlockData();
|
||||
MapBlockFromGridRegion(block, r);
|
||||
response.Add(block);
|
||||
break;
|
||||
}
|
||||
@@ -754,10 +775,28 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||
|
||||
protected virtual void GetAndSendBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag)
|
||||
{
|
||||
List<MapBlockData> mapBlocks = m_scene.SceneGridService.RequestNeighbourMapBlocks(minX - 4, minY - 4, maxX + 4, maxY + 4);
|
||||
List<MapBlockData> mapBlocks = new List<MapBlockData>();
|
||||
List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
|
||||
(minX - 4) * (int)Constants.RegionSize, (minY - 4) * (int)Constants.RegionSize,
|
||||
(maxX + 4) * (int)Constants.RegionSize, (maxY + 4) * (int)Constants.RegionSize);
|
||||
foreach (GridRegion r in regions)
|
||||
{
|
||||
MapBlockData block = new MapBlockData();
|
||||
MapBlockFromGridRegion(block, r);
|
||||
mapBlocks.Add(block);
|
||||
}
|
||||
remoteClient.SendMapBlock(mapBlocks, flag);
|
||||
}
|
||||
|
||||
protected void MapBlockFromGridRegion(MapBlockData block, GridRegion r)
|
||||
{
|
||||
block.Access = r.Access;
|
||||
block.MapImageId = r.TerrainImage;
|
||||
block.Name = r.RegionName;
|
||||
block.X = (ushort)(r.RegionLocX / Constants.RegionSize);
|
||||
block.Y = (ushort)(r.RegionLocY / Constants.RegionSize);
|
||||
}
|
||||
|
||||
public Hashtable OnHTTPGetMapImage(Hashtable keysvals)
|
||||
{
|
||||
m_log.Debug("[WORLD MAP]: Sending map image jpeg");
|
||||
@@ -874,31 +913,34 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||
m_log.InfoFormat(
|
||||
"[WORLD MAP]: Exporting world map for {0} to {1}", m_scene.RegionInfo.RegionName, exportPath);
|
||||
|
||||
List<MapBlockData> mapBlocks =
|
||||
m_scene.CommsManager.GridService.RequestNeighbourMapBlocks(
|
||||
(int)(m_scene.RegionInfo.RegionLocX - 9),
|
||||
(int)(m_scene.RegionInfo.RegionLocY - 9),
|
||||
(int)(m_scene.RegionInfo.RegionLocX + 9),
|
||||
(int)(m_scene.RegionInfo.RegionLocY + 9));
|
||||
List<MapBlockData> mapBlocks = new List<MapBlockData>();
|
||||
List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
|
||||
(int)(m_scene.RegionInfo.RegionLocX - 9) * (int)Constants.RegionSize,
|
||||
(int)(m_scene.RegionInfo.RegionLocY - 9) * (int)Constants.RegionSize,
|
||||
(int)(m_scene.RegionInfo.RegionLocX + 9) * (int)Constants.RegionSize,
|
||||
(int)(m_scene.RegionInfo.RegionLocY + 9) * (int)Constants.RegionSize);
|
||||
List<AssetBase> textures = new List<AssetBase>();
|
||||
List<Image> bitImages = new List<Image>();
|
||||
|
||||
foreach (MapBlockData mapBlock in mapBlocks)
|
||||
foreach (GridRegion r in regions)
|
||||
{
|
||||
MapBlockData mapBlock = new MapBlockData();
|
||||
MapBlockFromGridRegion(mapBlock, r);
|
||||
AssetBase texAsset = m_scene.AssetService.Get(mapBlock.MapImageId.ToString());
|
||||
|
||||
if (texAsset != null)
|
||||
{
|
||||
textures.Add(texAsset);
|
||||
}
|
||||
else
|
||||
{
|
||||
texAsset = m_scene.AssetService.Get(mapBlock.MapImageId.ToString());
|
||||
if (texAsset != null)
|
||||
{
|
||||
textures.Add(texAsset);
|
||||
}
|
||||
}
|
||||
//else
|
||||
//{
|
||||
// // WHAT?!? This doesn't seem right. Commenting (diva)
|
||||
// texAsset = m_scene.AssetService.Get(mapBlock.MapImageId.ToString());
|
||||
// if (texAsset != null)
|
||||
// {
|
||||
// textures.Add(texAsset);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
foreach (AssetBase asset in textures)
|
||||
|
||||
Reference in New Issue
Block a user