add GetRegionByHandle methods

This commit is contained in:
UbitUmarov
2020-08-25 15:01:55 +01:00
parent b6d26c89e6
commit 39ab8902da
5 changed files with 42 additions and 4 deletions

View File

@@ -212,13 +212,26 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
public GridRegion GetRegionByUUID(UUID scopeID, UUID regionID)
{
bool inCache = false;
GridRegion rinfo = m_RegionInfoCache.Get(scopeID,regionID,out inCache);
GridRegion rinfo = m_RegionInfoCache.Get(scopeID, regionID, out inCache);
if (inCache)
return rinfo;
rinfo = m_GridService.GetRegionByUUID(scopeID, regionID);
if(rinfo != null)
m_RegionInfoCache.Cache(scopeID, rinfo);
if (rinfo != null)
m_RegionInfoCache.Cache(scopeID, rinfo);
return rinfo;
}
public GridRegion GetRegionByHandle(UUID scopeID, ulong regionhandle)
{
bool inCache = false;
GridRegion rinfo = m_RegionInfoCache.Get(scopeID, regionhandle, out inCache);
if (inCache)
return rinfo;
rinfo = m_GridService.GetRegionByHandle(scopeID, regionhandle);
if (rinfo != null)
m_RegionInfoCache.Cache(scopeID, rinfo);
return rinfo;
}

View File

@@ -218,6 +218,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
return rinfo;
}
public GridRegion GetRegionByHandle(UUID scopeID, ulong regionhandle)
{
GridRegion rinfo = m_LocalGridService.GetRegionByHandle(scopeID, regionhandle);
if (rinfo != null)
return rinfo;
rinfo = m_RemoteGridService.GetRegionByHandle(scopeID, regionhandle);
m_RegionInfoCache.Cache(scopeID, rinfo);
return rinfo;
}
// Get a region given its base world coordinates (in meters).
// NOTE: this is NOT 'get a region by some point in the region'. The coordinate MUST
// be the base coordinate of the region.

View File

@@ -273,6 +273,13 @@ namespace OpenSim.Services.Connectors
return rinfo;
}
public GridRegion GetRegionByHandle(UUID scopeID, ulong regionhandle)
{
//still not on protocol
Util.RegionHandleToWorldLoc(regionhandle, out uint x, out uint y);
return GetRegionByPosition(scopeID, (int)x, (int)y);
}
public GridRegion GetRegionByPosition(UUID scopeID, int x, int y)
{
GridRegion rinfo = null;

View File

@@ -446,6 +446,13 @@ namespace OpenSim.Services.GridService
return null;
}
public GridRegion GetRegionByHandle(UUID scopeID, ulong regionhandle)
{
int x = (int)(regionhandle >> 32);
int y = (int)(regionhandle & 0xfffffffful);
return GetRegionByPosition(scopeID, x, y);
}
// Get a region given its base coordinates.
// NOTE: this is NOT 'get a region by some point in the region'. The coordinate MUST
// be the base coordinate of the region.

View File

@@ -66,7 +66,7 @@ namespace OpenSim.Services.Interfaces
List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID);
GridRegion GetRegionByUUID(UUID scopeID, UUID regionID);
GridRegion GetRegionByHandle(UUID scopeID, ulong regionhandle);
/// <summary>
/// Get the region at the given position (in meters)
/// </summary>