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.
0.7.1-dev
Justin Clark-Casey (justincc) 2011-04-06 17:19:31 +01:00
parent 2497962360
commit fa202a05e9
3 changed files with 66 additions and 18 deletions

View File

@ -82,8 +82,26 @@ namespace OpenSim.Framework
void ForceUpdateLandInfo(); void ForceUpdateLandInfo();
void SetLandBitmap(bool[,] bitmap); void SetLandBitmap(bool[,] bitmap);
/// <summary>
/// Get a land bitmap that would cover an entire region.
/// </summary>
/// <returns>The bitmap created.</returns>
bool[,] BasicFullRegionLandBitmap(); bool[,] BasicFullRegionLandBitmap();
/// <summary>
/// Create a square land bitmap.
/// </summary>
/// <remarks>
/// 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).
/// </remarks>
/// <param name="start_x"></param>
/// <param name="start_y"></param>
/// <param name="end_x"></param>
/// <param name="end_y"></param>
/// <returns>The bitmap created.</returns>
bool[,] GetSquareLandBitmap(int start_x, int start_y, int end_x, int end_y); 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[,] 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); bool[,] MergeLandBitmaps(bool[,] bitmap_base, bool[,] bitmap_add);
void SendForceObjectSelect(int local_id, int request_type, List<UUID> returnIDs, IClientAPI remote_client); void SendForceObjectSelect(int local_id, int request_type, List<UUID> returnIDs, IClientAPI remote_client);

View File

@ -701,23 +701,11 @@ namespace OpenSim.Region.CoreModules.World.Land
return LandBitmap; return LandBitmap;
} }
/// <summary>
/// Full sim land object creation
/// </summary>
/// <returns></returns>
public bool[,] BasicFullRegionLandBitmap() public bool[,] BasicFullRegionLandBitmap()
{ {
return GetSquareLandBitmap(0, 0, (int) Constants.RegionSize, (int) Constants.RegionSize); return GetSquareLandBitmap(0, 0, (int) Constants.RegionSize, (int) Constants.RegionSize);
} }
/// <summary>
/// Used to modify the bitmap between the x and y points. Points use 64 scale
/// </summary>
/// <param name="start_x"></param>
/// <param name="start_y"></param>
/// <param name="end_x"></param>
/// <param name="end_y"></param>
/// <returns></returns>
public bool[,] GetSquareLandBitmap(int start_x, int start_y, int end_x, int end_y) public bool[,] GetSquareLandBitmap(int start_x, int start_y, int end_x, int end_y)
{ {
bool[,] tempBitmap = new bool[64,64]; bool[,] tempBitmap = new bool[64,64];

View File

@ -49,6 +49,10 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
protected UUID m_otherUserId = new UUID("99999999-9999-9999-9999-999999999999"); protected UUID m_otherUserId = new UUID("99999999-9999-9999-9999-999999999999");
protected TestScene m_scene; protected TestScene m_scene;
protected PrimCountModule m_pcm; protected PrimCountModule m_pcm;
/// <summary>
/// A parcel that covers the entire sim.
/// </summary>
protected ILandObject m_lo; protected ILandObject m_lo;
[SetUp] [SetUp]
@ -60,9 +64,9 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
SceneSetupHelpers.SetupSceneModules(m_scene, lmm, m_pcm); SceneSetupHelpers.SetupSceneModules(m_scene, lmm, m_pcm);
ILandObject lo = new LandObject(m_userId, false, m_scene); ILandObject lo = new LandObject(m_userId, false, m_scene);
lo.SetLandBitmap(lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); lo.SetLandBitmap(
lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize / 4 - 1, (int)Constants.RegionSize / 4 - 1));
m_lo = lmm.AddLandObject(lo); m_lo = lmm.AddLandObject(lo);
//scene.loadAllLandObjectsFromStorage(scene.RegionInfo.originRegionID);
} }
/// <summary> /// <summary>
@ -124,7 +128,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
/// Test count after a parcel owner owned copied object is added. /// Test count after a parcel owner owned copied object is added.
/// </summary> /// </summary>
[Test] [Test]
public void TestCopiedOwnerObject() public void TestCopyOwnerObject()
{ {
TestHelper.InMethod(); TestHelper.InMethod();
// log4net.Config.XmlConfigurator.Configure(); // log4net.Config.XmlConfigurator.Configure();
@ -145,6 +149,44 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
Assert.That(pc.Simulator, Is.EqualTo(6)); Assert.That(pc.Simulator, Is.EqualTo(6));
} }
/// <summary>
/// Test that parcel counts update correctly when an object is moved between parcels, where that movement
/// is not done directly by the user/
/// </summary>
//[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));
}
/// <summary> /// <summary>
/// Test count after a parcel owner owned object is removed. /// Test count after a parcel owner owned object is removed.
/// </summary> /// </summary>