From e7d5ff9bd27dd8ff891a0182bec83a33b6e7d7a5 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 29 Jan 2011 02:24:27 +0000 Subject: Create the structure of classes and interfaces to replace the cruft that is in the land management module today --- .../CoreModules/World/Land/PrimCountModule.cs | 120 +++++++++++++++++++++ .../Framework/Interfaces/IPrimCountModule.cs | 2 + 2 files changed, 122 insertions(+) diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs index c39ac73..9689e04 100644 --- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs @@ -46,6 +46,8 @@ namespace OpenSim.Region.CoreModules.World.Land LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private Scene m_Scene; + private Dictionary m_PrimCounts = + new Dictionary(); public Type ReplaceableInterface { @@ -108,5 +110,123 @@ namespace OpenSim.Region.CoreModules.World.Land public void TaintPrimCount() { } + + public IPrimCounts GetPrimCounts(UUID parcelID) + { + PrimCounts primCounts; + + lock (m_PrimCounts) + { + if (m_PrimCounts.TryGetValue(parcelID, out primCounts)) + return primCounts; + + primCounts = new PrimCounts(parcelID, this); + m_PrimCounts[parcelID] = primCounts; + } + return primCounts; + } + + public int GetOwnerCount(UUID parcelID) + { + return 0; + } + + public int GetGroupCount(UUID parcelID) + { + return 0; + } + + public int GetOthersCount(UUID parcelID) + { + return 0; + } + + public int GetSimulatorCount(UUID parcelID) + { + return 0; + } + + public int GetUserCount(UUID parcelID, UUID userID) + { + return 0; + } + } + + public class PrimCounts : IPrimCounts + { + private PrimCountModule m_Parent; + private UUID m_ParcelID; + private UserPrimCounts m_UserPrimCounts; + + public PrimCounts (UUID parcelID, PrimCountModule parent) + { + m_ParcelID = parcelID; + m_Parent = parent; + + m_UserPrimCounts = new UserPrimCounts(this); + } + + public int Owner + { + get + { + return m_Parent.GetOwnerCount(m_ParcelID); + } + } + + public int Group + { + get + { + return m_Parent.GetGroupCount(m_ParcelID); + } + } + + public int Others + { + get + { + return m_Parent.GetOthersCount(m_ParcelID); + } + } + + public int Simulator + { + get + { + return m_Parent.GetSimulatorCount(m_ParcelID); + } + } + + public IUserPrimCounts Users + { + get + { + return m_UserPrimCounts; + } + } + + public int GetUserCount(UUID userID) + { + return m_Parent.GetUserCount(m_ParcelID, userID); + } + } + + public class UserPrimCounts : IUserPrimCounts + { + private PrimCounts m_Parent; + + public UserPrimCounts(PrimCounts parent) + { + m_Parent = parent; + } + + public int this[UUID userID] + { + get + { + return m_Parent.GetUserCount(userID); + } + } } } diff --git a/OpenSim/Region/Framework/Interfaces/IPrimCountModule.cs b/OpenSim/Region/Framework/Interfaces/IPrimCountModule.cs index 7b77b30..65158e1 100644 --- a/OpenSim/Region/Framework/Interfaces/IPrimCountModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IPrimCountModule.cs @@ -35,6 +35,8 @@ namespace OpenSim.Region.Framework.Interfaces void TaintPrimCount(ILandObject land); void TaintPrimCount(int x, int y); void TaintPrimCount(); + + IPrimCounts GetPrimCounts(UUID parcelID); } public interface IPrimCounts -- cgit v1.1