(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

@ -45,6 +45,11 @@ namespace OpenSim.Framework
/// Prims owned by others (not parcel owner or parcel group).
/// </summary>
int Others { get; }
/// <summary>
/// Selected prims
/// </summary>
int Selected { get; }
/// <summary>
/// Total prims on the parcel.

View File

@ -4343,28 +4343,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
updateMessage.SnapSelection = snap_selection;
updateMessage.SnapshotID = landData.SnapshotID;
updateMessage.Status = (ParcelStatus) landData.Status;
updateMessage.UserLocation = landData.UserLocation;
updateMessage.UserLookAt = landData.UserLookAt;
updateMessage.SnapshotID = landData.SnapshotID;
updateMessage.Status = (ParcelStatus) landData.Status;
updateMessage.UserLocation = landData.UserLocation;
updateMessage.UserLookAt = landData.UserLookAt;
updateMessage.MediaType = landData.MediaType;
updateMessage.MediaDesc = landData.MediaDescription;
updateMessage.MediaWidth = landData.MediaWidth;
updateMessage.MediaHeight = landData.MediaHeight;
updateMessage.MediaLoop = landData.MediaLoop;
updateMessage.ObscureMusic = landData.ObscureMusic;
updateMessage.ObscureMedia = landData.ObscureMedia;
updateMessage.MediaType = landData.MediaType;
updateMessage.MediaDesc = landData.MediaDescription;
updateMessage.MediaWidth = landData.MediaWidth;
updateMessage.MediaHeight = landData.MediaHeight;
updateMessage.MediaLoop = landData.MediaLoop;
updateMessage.ObscureMusic = landData.ObscureMusic;
updateMessage.ObscureMedia = landData.ObscureMedia;
IPrimCounts pc = lo.PrimCounts;
updateMessage.OwnerPrims = pc.Owner;
updateMessage.GroupPrims = pc.Group;
updateMessage.OtherPrims = pc.Others;
updateMessage.TotalPrims = pc.Total;
updateMessage.SimWideTotalPrims = pc.Simulator;
// TODO: Need to transfer selected prims to new prim count structure.
updateMessage.SelectedPrims = landData.SelectedPrims;
updateMessage.OwnerPrims = pc.Owner;
updateMessage.GroupPrims = pc.Group;
updateMessage.OtherPrims = pc.Others;
updateMessage.SelectedPrims = pc.Selected;
updateMessage.TotalPrims = pc.Total;
updateMessage.SimWideTotalPrims = pc.Simulator;
try
{
@ -4372,13 +4370,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (eq != null)
{
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)
{
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 Group = 0;
public int Others = 0;
public Dictionary <UUID, int> Users =
new Dictionary <UUID, int>();
public int Selected = 0;
public Dictionary <UUID, int> Users = new Dictionary <UUID, int>();
}
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 Dictionary<UUID, PrimCounts> m_PrimCounts =
@ -219,6 +219,9 @@ namespace OpenSim.Region.CoreModules.World.Land
else
parcelCounts.Others += partCount;
}
if (obj.IsSelected)
parcelCounts.Selected += partCount;
}
}
@ -327,6 +330,32 @@ namespace OpenSim.Region.CoreModules.World.Land
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>
/// Get the total count of owner, group and others prims on the parcel.
/// 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
{
get

View File

@ -79,6 +79,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
Assert.That(pc.Group, Is.EqualTo(0));
Assert.That(pc.Others, 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_dummyUserId], 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.Others, Is.EqualTo(0));
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_dummyUserId], Is.EqualTo(0));
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.Others, Is.EqualTo(0));
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_dummyUserId], Is.EqualTo(0));
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.Others, Is.EqualTo(0));
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_dummyUserId], Is.EqualTo(0));
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.Others, Is.EqualTo(0));
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_dummyUserId], Is.EqualTo(0));
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.Others, Is.EqualTo(0));
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_dummyUserId], Is.EqualTo(0));
Assert.That(pc.Simulator, Is.EqualTo(3));