From 541cd3e8c84d3ccc13525206b1724ee931416a3c Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 26 Mar 2011 02:19:28 +0000
Subject: move total parcel prim calculations into IPrimCounts instead of doing
this in LLClientView
need to move selected prim counts from LandData/LMM still
---
.../CoreModules/World/Land/PrimCountModule.cs | 39 ++++++++++++++++++++++
.../World/Land/Tests/PrimCountModuleTests.cs | 8 ++++-
2 files changed, 46 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region/CoreModules/World')
diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
index 72115a8..2de5c16 100644
--- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
@@ -324,6 +324,37 @@ namespace OpenSim.Region.CoreModules.World.Land
return count;
}
+
+ ///
+ /// Get the total count of owner, group and others prims on the parcel.
+ /// FIXME: Need to do selected prims once this is reimplemented.
+ ///
+ ///
+ ///
+ 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;
+ }
///
/// 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
{
diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
index dd55f98..58bd841 100644
--- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
+++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
@@ -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));
--
cgit v1.1