(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)
0.7.1-dev
Justin Clark-Casey (justincc) 2011-03-30 00:13:07 +01:00
parent f754dedbef
commit 8b16f7d976
4 changed files with 73 additions and 25 deletions

View File

@ -46,6 +46,11 @@ namespace OpenSim.Framework
/// </summary> /// </summary>
int Others { get; } int Others { get; }
/// <summary>
/// Selected prims
/// </summary>
int Selected { get; }
/// <summary> /// <summary>
/// Total prims on the parcel. /// Total prims on the parcel.
/// </summary> /// </summary>

View File

@ -4343,42 +4343,42 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
updateMessage.SnapSelection = snap_selection; updateMessage.SnapSelection = snap_selection;
updateMessage.SnapshotID = landData.SnapshotID; updateMessage.SnapshotID = landData.SnapshotID;
updateMessage.Status = (ParcelStatus) landData.Status; updateMessage.Status = (ParcelStatus) landData.Status;
updateMessage.UserLocation = landData.UserLocation; updateMessage.UserLocation = landData.UserLocation;
updateMessage.UserLookAt = landData.UserLookAt; updateMessage.UserLookAt = landData.UserLookAt;
updateMessage.MediaType = landData.MediaType; updateMessage.MediaType = landData.MediaType;
updateMessage.MediaDesc = landData.MediaDescription; updateMessage.MediaDesc = landData.MediaDescription;
updateMessage.MediaWidth = landData.MediaWidth; updateMessage.MediaWidth = landData.MediaWidth;
updateMessage.MediaHeight = landData.MediaHeight; updateMessage.MediaHeight = landData.MediaHeight;
updateMessage.MediaLoop = landData.MediaLoop; updateMessage.MediaLoop = landData.MediaLoop;
updateMessage.ObscureMusic = landData.ObscureMusic; updateMessage.ObscureMusic = landData.ObscureMusic;
updateMessage.ObscureMedia = landData.ObscureMedia; updateMessage.ObscureMedia = landData.ObscureMedia;
IPrimCounts pc = lo.PrimCounts; IPrimCounts pc = lo.PrimCounts;
updateMessage.OwnerPrims = pc.Owner; updateMessage.OwnerPrims = pc.Owner;
updateMessage.GroupPrims = pc.Group; updateMessage.GroupPrims = pc.Group;
updateMessage.OtherPrims = pc.Others; updateMessage.OtherPrims = pc.Others;
updateMessage.TotalPrims = pc.Total; updateMessage.SelectedPrims = pc.Selected;
updateMessage.TotalPrims = pc.Total;
updateMessage.SimWideTotalPrims = pc.Simulator; updateMessage.SimWideTotalPrims = pc.Simulator;
// TODO: Need to transfer selected prims to new prim count structure.
updateMessage.SelectedPrims = landData.SelectedPrims;
try try
{ {
IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>(); IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>();
if (eq != null) if (eq != null)
{ {
eq.ParcelProperties(updateMessage, this.AgentId); eq.ParcelProperties(updateMessage, this.AgentId);
} else { }
m_log.Warn("No EQ Interface when sending parcel data."); else
{
m_log.Warn("[LLCLIENTVIEW]: No EQ Interface when sending parcel data.");
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
m_log.Error("Unable to send parcel data via eventqueue - exception: " + ex.ToString()); m_log.Error("[LLCLIENTVIEW]: Unable to send parcel data via eventqueue - exception: " + ex.ToString());
} }
} }

View File

@ -45,13 +45,13 @@ namespace OpenSim.Region.CoreModules.World.Land
public int Owner = 0; public int Owner = 0;
public int Group = 0; public int Group = 0;
public int Others = 0; public int Others = 0;
public Dictionary <UUID, int> Users = public int Selected = 0;
new Dictionary <UUID, int>(); public Dictionary <UUID, int> Users = new Dictionary <UUID, int>();
} }
public class PrimCountModule : IPrimCountModule, INonSharedRegionModule public class PrimCountModule : IPrimCountModule, INonSharedRegionModule
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private Scene m_Scene; private Scene m_Scene;
private Dictionary<UUID, PrimCounts> m_PrimCounts = private Dictionary<UUID, PrimCounts> m_PrimCounts =
@ -219,6 +219,9 @@ namespace OpenSim.Region.CoreModules.World.Land
else else
parcelCounts.Others += partCount; parcelCounts.Others += partCount;
} }
if (obj.IsSelected)
parcelCounts.Selected += partCount;
} }
} }
@ -327,6 +330,32 @@ namespace OpenSim.Region.CoreModules.World.Land
return count; return count;
} }
/// <summary>
/// Get the number of selected prims.
/// </summary>
/// <param name="parcelID"></param>
/// <returns></returns>
public int GetSelectedCount(UUID parcelID)
{
int count = 0;
lock (m_TaintLock)
{
if (m_Tainted)
Recount();
ParcelCounts counts;
if (m_ParcelCounts.TryGetValue(parcelID, out counts))
count = counts.Selected;
}
// m_log.DebugFormat(
// "[PRIM COUNT MODULE]: GetSelectedCount for parcel {0} in {1} returning {2}",
// parcelID, m_Scene.RegionInfo.RegionName, count);
return count;
}
/// <summary> /// <summary>
/// Get the total count of owner, group and others prims on the parcel. /// Get the total count of owner, group and others prims on the parcel.
/// FIXME: Need to do selected prims once this is reimplemented. /// FIXME: Need to do selected prims once this is reimplemented.
@ -491,6 +520,14 @@ namespace OpenSim.Region.CoreModules.World.Land
} }
} }
public int Selected
{
get
{
return m_Parent.GetSelectedCount(m_ParcelID);
}
}
public int Total public int Total
{ {
get get

View File

@ -79,6 +79,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
Assert.That(pc.Group, Is.EqualTo(0)); Assert.That(pc.Group, Is.EqualTo(0));
Assert.That(pc.Others, Is.EqualTo(0)); Assert.That(pc.Others, Is.EqualTo(0));
Assert.That(pc.Total, Is.EqualTo(0)); Assert.That(pc.Total, Is.EqualTo(0));
Assert.That(pc.Selected, Is.EqualTo(0));
Assert.That(pc.Users[m_userId], Is.EqualTo(0)); Assert.That(pc.Users[m_userId], Is.EqualTo(0));
Assert.That(pc.Users[m_dummyUserId], 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));
@ -90,6 +91,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
Assert.That(pc.Group, Is.EqualTo(0)); Assert.That(pc.Group, Is.EqualTo(0));
Assert.That(pc.Others, Is.EqualTo(0)); Assert.That(pc.Others, Is.EqualTo(0));
Assert.That(pc.Total, Is.EqualTo(3)); Assert.That(pc.Total, Is.EqualTo(3));
Assert.That(pc.Selected, Is.EqualTo(0));
Assert.That(pc.Users[m_userId], Is.EqualTo(3)); Assert.That(pc.Users[m_userId], Is.EqualTo(3));
Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0));
Assert.That(pc.Simulator, Is.EqualTo(3)); Assert.That(pc.Simulator, Is.EqualTo(3));
@ -102,6 +104,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
Assert.That(pc.Group, Is.EqualTo(0)); Assert.That(pc.Group, Is.EqualTo(0));
Assert.That(pc.Others, Is.EqualTo(0)); Assert.That(pc.Others, Is.EqualTo(0));
Assert.That(pc.Total, Is.EqualTo(5)); Assert.That(pc.Total, Is.EqualTo(5));
Assert.That(pc.Selected, Is.EqualTo(0));
Assert.That(pc.Users[m_userId], Is.EqualTo(5)); Assert.That(pc.Users[m_userId], Is.EqualTo(5));
Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0));
Assert.That(pc.Simulator, Is.EqualTo(5)); Assert.That(pc.Simulator, Is.EqualTo(5));
@ -126,6 +129,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
Assert.That(pc.Group, Is.EqualTo(0)); Assert.That(pc.Group, Is.EqualTo(0));
Assert.That(pc.Others, Is.EqualTo(0)); Assert.That(pc.Others, Is.EqualTo(0));
Assert.That(pc.Total, Is.EqualTo(6)); Assert.That(pc.Total, Is.EqualTo(6));
Assert.That(pc.Selected, Is.EqualTo(0));
Assert.That(pc.Users[m_userId], Is.EqualTo(6)); Assert.That(pc.Users[m_userId], Is.EqualTo(6));
Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0));
Assert.That(pc.Simulator, Is.EqualTo(6)); Assert.That(pc.Simulator, Is.EqualTo(6));
@ -151,6 +155,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
Assert.That(pc.Group, Is.EqualTo(0)); Assert.That(pc.Group, Is.EqualTo(0));
Assert.That(pc.Others, Is.EqualTo(0)); Assert.That(pc.Others, Is.EqualTo(0));
Assert.That(pc.Total, Is.EqualTo(1)); Assert.That(pc.Total, Is.EqualTo(1));
Assert.That(pc.Selected, Is.EqualTo(0));
Assert.That(pc.Users[m_userId], Is.EqualTo(1)); Assert.That(pc.Users[m_userId], Is.EqualTo(1));
Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0));
Assert.That(pc.Simulator, Is.EqualTo(1)); Assert.That(pc.Simulator, Is.EqualTo(1));
@ -174,6 +179,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
Assert.That(pc.Group, Is.EqualTo(0)); Assert.That(pc.Group, Is.EqualTo(0));
Assert.That(pc.Others, Is.EqualTo(0)); Assert.That(pc.Others, Is.EqualTo(0));
Assert.That(pc.Total, Is.EqualTo(3)); Assert.That(pc.Total, Is.EqualTo(3));
Assert.That(pc.Selected, Is.EqualTo(0));
Assert.That(pc.Users[m_userId], Is.EqualTo(3)); Assert.That(pc.Users[m_userId], Is.EqualTo(3));
Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0));
Assert.That(pc.Simulator, Is.EqualTo(3)); Assert.That(pc.Simulator, Is.EqualTo(3));