move total parcel prim calculations into IPrimCounts instead of doing this in LLClientView

need to move selected prim counts from LandData/LMM still
0.7.1-dev
Justin Clark-Casey (justincc) 2011-03-26 02:19:28 +00:00
parent bfd9cc44b4
commit 541cd3e8c8
3 changed files with 70 additions and 1 deletions

View File

@ -31,10 +31,34 @@ namespace OpenSim.Framework
{
public interface IPrimCounts
{
/// <summary>
/// Parcel owner owned prims
/// </summary>
int Owner { get; }
/// <summary>
/// Parcel group owned prims
/// </summary>
int Group { get; }
/// <summary>
/// Prims owned by others (not parcel owner or parcel group).
/// </summary>
int Others { get; }
/// <summary>
/// Total prims on the parcel.
/// </summary>
int Total { get; }
/// <summary>
/// Prims on the simulator that are owned by the parcel owner, even if they are in other parcels.
/// </summary>
int Simulator { get; }
/// <summary>
/// Prims per individual users.
/// </summary>
IUserPrimCounts Users { get; }
}

View File

@ -324,6 +324,37 @@ namespace OpenSim.Region.CoreModules.World.Land
return count;
}
/// <summary>
/// Get the total count of owner, group and others prims on the parcel.
/// FIXME: Need to do selected prims once this is reimplemented.
/// </summary>
/// <param name="parcelID"></param>
/// <returns></returns>
public int GetTotalCount(UUID parcelID)
{
int count = 0;
lock (m_TaintLock)
{
if (m_Tainted)
Recount();
ParcelCounts counts;
if (m_ParcelCounts.TryGetValue(parcelID, out counts))
{
count = counts.Owner;
count += counts.Group;
count += counts.Others;
}
}
m_log.DebugFormat(
"[PRIM COUNT MODULE]: GetTotalCount for parcel {0} in {1} returning {2}",
parcelID, m_Scene.RegionInfo.RegionName, count);
return count;
}
/// <summary>
/// Get the number of prims that are in the entire simulator for the owner of this parcel.
@ -457,6 +488,14 @@ namespace OpenSim.Region.CoreModules.World.Land
return m_Parent.GetOthersCount(m_ParcelID);
}
}
public int Total
{
get
{
return m_Parent.GetTotalCount(m_ParcelID);
}
}
public int Simulator
{

View File

@ -78,9 +78,10 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
Assert.That(pc.Owner, Is.EqualTo(0));
Assert.That(pc.Group, Is.EqualTo(0));
Assert.That(pc.Others, Is.EqualTo(0));
Assert.That(pc.Total, Is.EqualTo(0));
Assert.That(pc.Users[m_userId], Is.EqualTo(0));
Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0));
Assert.That(pc.Simulator, Is.EqualTo(0));
Assert.That(pc.Simulator, Is.EqualTo(0));
SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x01);
m_scene.AddNewSceneObject(sog, false);
@ -88,6 +89,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
Assert.That(pc.Owner, Is.EqualTo(3));
Assert.That(pc.Group, Is.EqualTo(0));
Assert.That(pc.Others, Is.EqualTo(0));
Assert.That(pc.Total, Is.EqualTo(3));
Assert.That(pc.Users[m_userId], Is.EqualTo(3));
Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0));
Assert.That(pc.Simulator, Is.EqualTo(3));
@ -99,6 +101,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
Assert.That(pc.Owner, Is.EqualTo(5));
Assert.That(pc.Group, Is.EqualTo(0));
Assert.That(pc.Others, Is.EqualTo(0));
Assert.That(pc.Total, Is.EqualTo(5));
Assert.That(pc.Users[m_userId], Is.EqualTo(5));
Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0));
Assert.That(pc.Simulator, Is.EqualTo(5));
@ -122,6 +125,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
Assert.That(pc.Owner, Is.EqualTo(6));
Assert.That(pc.Group, Is.EqualTo(0));
Assert.That(pc.Others, Is.EqualTo(0));
Assert.That(pc.Total, Is.EqualTo(6));
Assert.That(pc.Users[m_userId], Is.EqualTo(6));
Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0));
Assert.That(pc.Simulator, Is.EqualTo(6));
@ -146,6 +150,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
Assert.That(pc.Owner, Is.EqualTo(1));
Assert.That(pc.Group, Is.EqualTo(0));
Assert.That(pc.Others, Is.EqualTo(0));
Assert.That(pc.Total, Is.EqualTo(1));
Assert.That(pc.Users[m_userId], Is.EqualTo(1));
Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0));
Assert.That(pc.Simulator, Is.EqualTo(1));
@ -168,6 +173,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
Assert.That(pc.Owner, Is.EqualTo(3));
Assert.That(pc.Group, Is.EqualTo(0));
Assert.That(pc.Others, Is.EqualTo(0));
Assert.That(pc.Total, Is.EqualTo(3));
Assert.That(pc.Users[m_userId], Is.EqualTo(3));
Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0));
Assert.That(pc.Simulator, Is.EqualTo(3));