From fa202a05e914395d5a1facf8bdadb6a553516bfe Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 6 Apr 2011 17:19:31 +0100 Subject: Add method doc to some land bitmap methods in ILandObject. Also changes prim count tests to use the correct upper region bounds, though the method actually ignores the overage. --- OpenSim/Framework/ILandObject.cs | 18 ++++++++ .../Region/CoreModules/World/Land/LandObject.cs | 14 +----- .../World/Land/Tests/PrimCountModuleTests.cs | 52 +++++++++++++++++++--- 3 files changed, 66 insertions(+), 18 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/ILandObject.cs b/OpenSim/Framework/ILandObject.cs index 98ea01e..02775e9 100644 --- a/OpenSim/Framework/ILandObject.cs +++ b/OpenSim/Framework/ILandObject.cs @@ -82,8 +82,26 @@ namespace OpenSim.Framework void ForceUpdateLandInfo(); void SetLandBitmap(bool[,] bitmap); + /// + /// Get a land bitmap that would cover an entire region. + /// + /// The bitmap created. bool[,] BasicFullRegionLandBitmap(); + + /// + /// Create a square land bitmap. + /// + /// + /// Land co-ordinates are zero indexed. At the moment, the smallest parcel of land is 4m x 4m, so if the + /// region is 256 x 256m (the SL size), the largest land parcel starts at (0,0) and ends at (63,63). + /// + /// + /// + /// + /// + /// The bitmap created. bool[,] GetSquareLandBitmap(int start_x, int start_y, int end_x, int end_y); + bool[,] ModifyLandBitmapSquare(bool[,] land_bitmap, int start_x, int start_y, int end_x, int end_y, bool set_value); bool[,] MergeLandBitmaps(bool[,] bitmap_base, bool[,] bitmap_add); void SendForceObjectSelect(int local_id, int request_type, List returnIDs, IClientAPI remote_client); diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index c4fb11e..c2f104e 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs @@ -701,23 +701,11 @@ namespace OpenSim.Region.CoreModules.World.Land return LandBitmap; } - /// - /// Full sim land object creation - /// - /// public bool[,] BasicFullRegionLandBitmap() { return GetSquareLandBitmap(0, 0, (int) Constants.RegionSize, (int) Constants.RegionSize); } - - /// - /// Used to modify the bitmap between the x and y points. Points use 64 scale - /// - /// - /// - /// - /// - /// + public bool[,] GetSquareLandBitmap(int start_x, int start_y, int end_x, int end_y) { bool[,] tempBitmap = new bool[64,64]; diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs index f006db2..4acba18 100644 --- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs @@ -49,6 +49,10 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests protected UUID m_otherUserId = new UUID("99999999-9999-9999-9999-999999999999"); protected TestScene m_scene; protected PrimCountModule m_pcm; + + /// + /// A parcel that covers the entire sim. + /// protected ILandObject m_lo; [SetUp] @@ -60,9 +64,9 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests SceneSetupHelpers.SetupSceneModules(m_scene, lmm, m_pcm); ILandObject lo = new LandObject(m_userId, false, m_scene); - lo.SetLandBitmap(lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); - m_lo = lmm.AddLandObject(lo); - //scene.loadAllLandObjectsFromStorage(scene.RegionInfo.originRegionID); + lo.SetLandBitmap( + lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize / 4 - 1, (int)Constants.RegionSize / 4 - 1)); + m_lo = lmm.AddLandObject(lo); } /// @@ -124,7 +128,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests /// Test count after a parcel owner owned copied object is added. /// [Test] - public void TestCopiedOwnerObject() + public void TestCopyOwnerObject() { TestHelper.InMethod(); // log4net.Config.XmlConfigurator.Configure(); @@ -143,7 +147,45 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pc.Users[m_userId], Is.EqualTo(6)); Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0)); Assert.That(pc.Simulator, Is.EqualTo(6)); - } + } + + /// + /// Test that parcel counts update correctly when an object is moved between parcels, where that movement + /// is not done directly by the user/ + /// + //[Test] + public void TestMoveOwnerObject() + { +// TestHelper.InMethod(); +//// log4net.Config.XmlConfigurator.Configure(); +// +// IPrimCounts pc = m_lo.PrimCounts; +// +// SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x01); +// m_scene.AddNewSceneObject(sog, false); +// +// Assert.That(pc.Owner, Is.EqualTo(3)); +// 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_otherUserId], Is.EqualTo(0)); +// Assert.That(pc.Simulator, Is.EqualTo(3)); +// +// // Add a second object and retest +// SceneObjectGroup sog2 = SceneSetupHelpers.CreateSceneObject(2, m_userId, 0x10); +// m_scene.AddNewSceneObject(sog2, false); +// +// Assert.That(pc.Owner, Is.EqualTo(5)); +// 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_otherUserId], Is.EqualTo(0)); +// Assert.That(pc.Simulator, Is.EqualTo(5)); + } /// /// Test count after a parcel owner owned object is removed. -- cgit v1.1