aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs39
-rw-r--r--OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs8
2 files changed, 46 insertions, 1 deletions
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
324 324
325 return count; 325 return count;
326 } 326 }
327
328 /// <summary>
329 /// Get the total count of owner, group and others prims on the parcel.
330 /// FIXME: Need to do selected prims once this is reimplemented.
331 /// </summary>
332 /// <param name="parcelID"></param>
333 /// <returns></returns>
334 public int GetTotalCount(UUID parcelID)
335 {
336 int count = 0;
337
338 lock (m_TaintLock)
339 {
340 if (m_Tainted)
341 Recount();
342
343 ParcelCounts counts;
344 if (m_ParcelCounts.TryGetValue(parcelID, out counts))
345 {
346 count = counts.Owner;
347 count += counts.Group;
348 count += counts.Others;
349 }
350 }
351
352 m_log.DebugFormat(
353 "[PRIM COUNT MODULE]: GetTotalCount for parcel {0} in {1} returning {2}",
354 parcelID, m_Scene.RegionInfo.RegionName, count);
355
356 return count;
357 }
327 358
328 /// <summary> 359 /// <summary>
329 /// Get the number of prims that are in the entire simulator for the owner of this parcel. 360 /// 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
457 return m_Parent.GetOthersCount(m_ParcelID); 488 return m_Parent.GetOthersCount(m_ParcelID);
458 } 489 }
459 } 490 }
491
492 public int Total
493 {
494 get
495 {
496 return m_Parent.GetTotalCount(m_ParcelID);
497 }
498 }
460 499
461 public int Simulator 500 public int Simulator
462 { 501 {
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
78 Assert.That(pc.Owner, Is.EqualTo(0)); 78 Assert.That(pc.Owner, Is.EqualTo(0));
79 Assert.That(pc.Group, Is.EqualTo(0)); 79 Assert.That(pc.Group, Is.EqualTo(0));
80 Assert.That(pc.Others, Is.EqualTo(0)); 80 Assert.That(pc.Others, Is.EqualTo(0));
81 Assert.That(pc.Total, Is.EqualTo(0));
81 Assert.That(pc.Users[m_userId], Is.EqualTo(0)); 82 Assert.That(pc.Users[m_userId], Is.EqualTo(0));
82 Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); 83 Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0));
83 Assert.That(pc.Simulator, Is.EqualTo(0)); 84 Assert.That(pc.Simulator, Is.EqualTo(0));
84 85
85 SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x01); 86 SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x01);
86 m_scene.AddNewSceneObject(sog, false); 87 m_scene.AddNewSceneObject(sog, false);
@@ -88,6 +89,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
88 Assert.That(pc.Owner, Is.EqualTo(3)); 89 Assert.That(pc.Owner, Is.EqualTo(3));
89 Assert.That(pc.Group, Is.EqualTo(0)); 90 Assert.That(pc.Group, Is.EqualTo(0));
90 Assert.That(pc.Others, Is.EqualTo(0)); 91 Assert.That(pc.Others, Is.EqualTo(0));
92 Assert.That(pc.Total, Is.EqualTo(3));
91 Assert.That(pc.Users[m_userId], Is.EqualTo(3)); 93 Assert.That(pc.Users[m_userId], Is.EqualTo(3));
92 Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); 94 Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0));
93 Assert.That(pc.Simulator, Is.EqualTo(3)); 95 Assert.That(pc.Simulator, Is.EqualTo(3));
@@ -99,6 +101,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
99 Assert.That(pc.Owner, Is.EqualTo(5)); 101 Assert.That(pc.Owner, Is.EqualTo(5));
100 Assert.That(pc.Group, Is.EqualTo(0)); 102 Assert.That(pc.Group, Is.EqualTo(0));
101 Assert.That(pc.Others, Is.EqualTo(0)); 103 Assert.That(pc.Others, Is.EqualTo(0));
104 Assert.That(pc.Total, Is.EqualTo(5));
102 Assert.That(pc.Users[m_userId], Is.EqualTo(5)); 105 Assert.That(pc.Users[m_userId], Is.EqualTo(5));
103 Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); 106 Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0));
104 Assert.That(pc.Simulator, Is.EqualTo(5)); 107 Assert.That(pc.Simulator, Is.EqualTo(5));
@@ -122,6 +125,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
122 Assert.That(pc.Owner, Is.EqualTo(6)); 125 Assert.That(pc.Owner, Is.EqualTo(6));
123 Assert.That(pc.Group, Is.EqualTo(0)); 126 Assert.That(pc.Group, Is.EqualTo(0));
124 Assert.That(pc.Others, Is.EqualTo(0)); 127 Assert.That(pc.Others, Is.EqualTo(0));
128 Assert.That(pc.Total, Is.EqualTo(6));
125 Assert.That(pc.Users[m_userId], Is.EqualTo(6)); 129 Assert.That(pc.Users[m_userId], Is.EqualTo(6));
126 Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); 130 Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0));
127 Assert.That(pc.Simulator, Is.EqualTo(6)); 131 Assert.That(pc.Simulator, Is.EqualTo(6));
@@ -146,6 +150,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
146 Assert.That(pc.Owner, Is.EqualTo(1)); 150 Assert.That(pc.Owner, Is.EqualTo(1));
147 Assert.That(pc.Group, Is.EqualTo(0)); 151 Assert.That(pc.Group, Is.EqualTo(0));
148 Assert.That(pc.Others, Is.EqualTo(0)); 152 Assert.That(pc.Others, Is.EqualTo(0));
153 Assert.That(pc.Total, Is.EqualTo(1));
149 Assert.That(pc.Users[m_userId], Is.EqualTo(1)); 154 Assert.That(pc.Users[m_userId], Is.EqualTo(1));
150 Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); 155 Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0));
151 Assert.That(pc.Simulator, Is.EqualTo(1)); 156 Assert.That(pc.Simulator, Is.EqualTo(1));
@@ -168,6 +173,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
168 Assert.That(pc.Owner, Is.EqualTo(3)); 173 Assert.That(pc.Owner, Is.EqualTo(3));
169 Assert.That(pc.Group, Is.EqualTo(0)); 174 Assert.That(pc.Group, Is.EqualTo(0));
170 Assert.That(pc.Others, Is.EqualTo(0)); 175 Assert.That(pc.Others, Is.EqualTo(0));
176 Assert.That(pc.Total, Is.EqualTo(3));
171 Assert.That(pc.Users[m_userId], Is.EqualTo(3)); 177 Assert.That(pc.Users[m_userId], Is.EqualTo(3));
172 Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); 178 Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0));
173 Assert.That(pc.Simulator, Is.EqualTo(3)); 179 Assert.That(pc.Simulator, Is.EqualTo(3));