diff options
author | Justin Clark-Casey (justincc) | 2011-03-30 00:13:07 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-03-30 00:13:07 +0100 |
commit | 8b16f7d976dc60b06f6d08e9d9d853ae69de5fc9 (patch) | |
tree | 9cb7254d3731c28aca723a0c6745909319553c66 /OpenSim/Region/CoreModules/World/Land | |
parent | Merge branch 'primcounts' (diff) | |
download | opensim-SC_OLD-8b16f7d976dc60b06f6d08e9d9d853ae69de5fc9.zip opensim-SC_OLD-8b16f7d976dc60b06f6d08e9d9d853ae69de5fc9.tar.gz opensim-SC_OLD-8b16f7d976dc60b06f6d08e9d9d853ae69de5fc9.tar.bz2 opensim-SC_OLD-8b16f7d976dc60b06f6d08e9d9d853ae69de5fc9.tar.xz |
(re)implement selected prim count.
This does not currently count objects that are sat upon (which the viewer ui implies should be included in this count)
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Land')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs | 43 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs | 6 |
2 files changed, 46 insertions, 3 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs index d126b26..ab0e88e 100644 --- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs | |||
@@ -45,13 +45,13 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
45 | public int Owner = 0; | 45 | public int Owner = 0; |
46 | public int Group = 0; | 46 | public int Group = 0; |
47 | public int Others = 0; | 47 | public int Others = 0; |
48 | public Dictionary <UUID, int> Users = | 48 | public int Selected = 0; |
49 | new Dictionary <UUID, int>(); | 49 | public Dictionary <UUID, int> Users = new Dictionary <UUID, int>(); |
50 | } | 50 | } |
51 | 51 | ||
52 | public class PrimCountModule : IPrimCountModule, INonSharedRegionModule | 52 | public class PrimCountModule : IPrimCountModule, INonSharedRegionModule |
53 | { | 53 | { |
54 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 54 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
55 | 55 | ||
56 | private Scene m_Scene; | 56 | private Scene m_Scene; |
57 | private Dictionary<UUID, PrimCounts> m_PrimCounts = | 57 | private Dictionary<UUID, PrimCounts> m_PrimCounts = |
@@ -219,6 +219,9 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
219 | else | 219 | else |
220 | parcelCounts.Others += partCount; | 220 | parcelCounts.Others += partCount; |
221 | } | 221 | } |
222 | |||
223 | if (obj.IsSelected) | ||
224 | parcelCounts.Selected += partCount; | ||
222 | } | 225 | } |
223 | } | 226 | } |
224 | 227 | ||
@@ -328,6 +331,32 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
328 | } | 331 | } |
329 | 332 | ||
330 | /// <summary> | 333 | /// <summary> |
334 | /// Get the number of selected prims. | ||
335 | /// </summary> | ||
336 | /// <param name="parcelID"></param> | ||
337 | /// <returns></returns> | ||
338 | public int GetSelectedCount(UUID parcelID) | ||
339 | { | ||
340 | int count = 0; | ||
341 | |||
342 | lock (m_TaintLock) | ||
343 | { | ||
344 | if (m_Tainted) | ||
345 | Recount(); | ||
346 | |||
347 | ParcelCounts counts; | ||
348 | if (m_ParcelCounts.TryGetValue(parcelID, out counts)) | ||
349 | count = counts.Selected; | ||
350 | } | ||
351 | |||
352 | // m_log.DebugFormat( | ||
353 | // "[PRIM COUNT MODULE]: GetSelectedCount for parcel {0} in {1} returning {2}", | ||
354 | // parcelID, m_Scene.RegionInfo.RegionName, count); | ||
355 | |||
356 | return count; | ||
357 | } | ||
358 | |||
359 | /// <summary> | ||
331 | /// Get the total count of owner, group and others prims on the parcel. | 360 | /// Get the total count of owner, group and others prims on the parcel. |
332 | /// FIXME: Need to do selected prims once this is reimplemented. | 361 | /// FIXME: Need to do selected prims once this is reimplemented. |
333 | /// </summary> | 362 | /// </summary> |
@@ -491,6 +520,14 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
491 | } | 520 | } |
492 | } | 521 | } |
493 | 522 | ||
523 | public int Selected | ||
524 | { | ||
525 | get | ||
526 | { | ||
527 | return m_Parent.GetSelectedCount(m_ParcelID); | ||
528 | } | ||
529 | } | ||
530 | |||
494 | public int Total | 531 | public int Total |
495 | { | 532 | { |
496 | get | 533 | get |
diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs index 58bd841..5a60f22 100644 --- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs | |||
@@ -79,6 +79,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests | |||
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.Total, Is.EqualTo(0)); |
82 | Assert.That(pc.Selected, Is.EqualTo(0)); | ||
82 | Assert.That(pc.Users[m_userId], Is.EqualTo(0)); | 83 | Assert.That(pc.Users[m_userId], Is.EqualTo(0)); |
83 | Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); | 84 | Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); |
84 | Assert.That(pc.Simulator, Is.EqualTo(0)); | 85 | Assert.That(pc.Simulator, Is.EqualTo(0)); |
@@ -90,6 +91,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests | |||
90 | Assert.That(pc.Group, Is.EqualTo(0)); | 91 | Assert.That(pc.Group, Is.EqualTo(0)); |
91 | Assert.That(pc.Others, Is.EqualTo(0)); | 92 | Assert.That(pc.Others, Is.EqualTo(0)); |
92 | Assert.That(pc.Total, Is.EqualTo(3)); | 93 | Assert.That(pc.Total, Is.EqualTo(3)); |
94 | Assert.That(pc.Selected, Is.EqualTo(0)); | ||
93 | Assert.That(pc.Users[m_userId], Is.EqualTo(3)); | 95 | Assert.That(pc.Users[m_userId], Is.EqualTo(3)); |
94 | Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); | 96 | Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); |
95 | Assert.That(pc.Simulator, Is.EqualTo(3)); | 97 | Assert.That(pc.Simulator, Is.EqualTo(3)); |
@@ -102,6 +104,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests | |||
102 | Assert.That(pc.Group, Is.EqualTo(0)); | 104 | Assert.That(pc.Group, Is.EqualTo(0)); |
103 | Assert.That(pc.Others, Is.EqualTo(0)); | 105 | Assert.That(pc.Others, Is.EqualTo(0)); |
104 | Assert.That(pc.Total, Is.EqualTo(5)); | 106 | Assert.That(pc.Total, Is.EqualTo(5)); |
107 | Assert.That(pc.Selected, Is.EqualTo(0)); | ||
105 | Assert.That(pc.Users[m_userId], Is.EqualTo(5)); | 108 | Assert.That(pc.Users[m_userId], Is.EqualTo(5)); |
106 | Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); | 109 | Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); |
107 | Assert.That(pc.Simulator, Is.EqualTo(5)); | 110 | Assert.That(pc.Simulator, Is.EqualTo(5)); |
@@ -126,6 +129,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests | |||
126 | Assert.That(pc.Group, Is.EqualTo(0)); | 129 | Assert.That(pc.Group, Is.EqualTo(0)); |
127 | Assert.That(pc.Others, Is.EqualTo(0)); | 130 | Assert.That(pc.Others, Is.EqualTo(0)); |
128 | Assert.That(pc.Total, Is.EqualTo(6)); | 131 | Assert.That(pc.Total, Is.EqualTo(6)); |
132 | Assert.That(pc.Selected, Is.EqualTo(0)); | ||
129 | Assert.That(pc.Users[m_userId], Is.EqualTo(6)); | 133 | Assert.That(pc.Users[m_userId], Is.EqualTo(6)); |
130 | Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); | 134 | Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); |
131 | Assert.That(pc.Simulator, Is.EqualTo(6)); | 135 | Assert.That(pc.Simulator, Is.EqualTo(6)); |
@@ -151,6 +155,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests | |||
151 | Assert.That(pc.Group, Is.EqualTo(0)); | 155 | Assert.That(pc.Group, Is.EqualTo(0)); |
152 | Assert.That(pc.Others, Is.EqualTo(0)); | 156 | Assert.That(pc.Others, Is.EqualTo(0)); |
153 | Assert.That(pc.Total, Is.EqualTo(1)); | 157 | Assert.That(pc.Total, Is.EqualTo(1)); |
158 | Assert.That(pc.Selected, Is.EqualTo(0)); | ||
154 | Assert.That(pc.Users[m_userId], Is.EqualTo(1)); | 159 | Assert.That(pc.Users[m_userId], Is.EqualTo(1)); |
155 | Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); | 160 | Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); |
156 | Assert.That(pc.Simulator, Is.EqualTo(1)); | 161 | Assert.That(pc.Simulator, Is.EqualTo(1)); |
@@ -174,6 +179,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests | |||
174 | Assert.That(pc.Group, Is.EqualTo(0)); | 179 | Assert.That(pc.Group, Is.EqualTo(0)); |
175 | Assert.That(pc.Others, Is.EqualTo(0)); | 180 | Assert.That(pc.Others, Is.EqualTo(0)); |
176 | Assert.That(pc.Total, Is.EqualTo(3)); | 181 | Assert.That(pc.Total, Is.EqualTo(3)); |
182 | Assert.That(pc.Selected, Is.EqualTo(0)); | ||
177 | Assert.That(pc.Users[m_userId], Is.EqualTo(3)); | 183 | Assert.That(pc.Users[m_userId], Is.EqualTo(3)); |
178 | Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); | 184 | Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); |
179 | Assert.That(pc.Simulator, Is.EqualTo(3)); | 185 | Assert.That(pc.Simulator, Is.EqualTo(3)); |