1
0

ILandObject.cs 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. /*
  2. * Copyright (c) Contributors, http://opensimulator.org/
  3. * See CONTRIBUTORS.TXT for a full list of copyright holders.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are met:
  7. * * Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * * Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * * Neither the name of the OpenSimulator Project nor the
  13. * names of its contributors may be used to endorse or promote products
  14. * derived from this software without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
  17. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  18. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  19. * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
  20. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  21. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  22. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  23. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  25. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. using System.Collections.Generic;
  28. using OpenMetaverse;
  29. namespace OpenSim.Framework
  30. {
  31. public delegate int overrideParcelMaxPrimCountDelegate(ILandObject obj);
  32. public delegate int overrideSimulatorMaxPrimCountDelegate(ILandObject obj);
  33. public interface ILandObject
  34. {
  35. int GetParcelMaxPrimCount();
  36. int GetSimulatorMaxPrimCount();
  37. int GetPrimsFree();
  38. Dictionary<UUID, int> GetLandObjectOwners();
  39. LandData LandData { get; set; }
  40. bool[,] LandBitmap { get; set; }
  41. UUID RegionUUID { get; }
  42. UUID GlobalID { get; }
  43. UUID FakeID { get; }
  44. int LocalID { get; }
  45. UUID OwnerID { get; }
  46. UUID GroupID { get; }
  47. /// <summary>
  48. /// Prim counts for this land object.
  49. /// </summary>
  50. IPrimCounts PrimCounts { get; set; }
  51. /// <summary>
  52. /// The start point for the land object. This is the northern-most point as one scans land working from
  53. /// west to east.
  54. /// </summary>
  55. Vector2 StartPoint { get; }
  56. /// <summary>
  57. /// The end point for the land object. This is the southern-most point as one scans land working from
  58. /// west to east.
  59. /// </summary>
  60. Vector2 EndPoint { get; }
  61. // a estimation of a parcel center.
  62. Vector2 CenterPoint { get; }
  63. // get positions
  64. Vector2? GetNearestPoint(Vector3 pos);
  65. Vector2? GetNearestPointAlongDirection(Vector3 pos, Vector3 pdirection);
  66. bool ContainsPoint(int x, int y);
  67. ILandObject Copy();
  68. void SendLandUpdateToAvatarsOverMe();
  69. void SendLandUpdateToAvatars();
  70. void SendLandProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client);
  71. bool UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client, out bool snap_selection, out bool needOverlay);
  72. bool IsEitherBannedOrRestricted(UUID avatar);
  73. bool IsBannedFromLand(UUID avatar);
  74. bool CanBeOnThisLand(UUID avatar, float posHeight);
  75. bool IsRestrictedFromLand(UUID avatar);
  76. bool IsInLandAccessList(UUID avatar);
  77. void SendLandUpdateToClient(IClientAPI remote_client);
  78. void SendLandUpdateToClient(bool snap_selection, IClientAPI remote_client);
  79. List<LandAccessEntry> CreateAccessListArrayByFlag(AccessList flag);
  80. void SendAccessList(UUID agentID, UUID sessionID, uint flags, int sequenceID, IClientAPI remote_client);
  81. void UpdateAccessList(uint flags, UUID transationID, List<LandAccessEntry> entries);
  82. void UpdateLandBitmapByteArray();
  83. void SetLandBitmapFromByteArray();
  84. bool[,] GetLandBitmap();
  85. void ForceUpdateLandInfo();
  86. void SetLandBitmap(bool[,] bitmap);
  87. /// <summary>
  88. /// Get a land bitmap that would cover an entire region.
  89. /// </summary>
  90. /// <returns>The bitmap created.</returns>
  91. bool[,] BasicFullRegionLandBitmap();
  92. /// <summary>
  93. /// Create a land bitmap.
  94. /// Square name is wrong kept bc legacy
  95. /// </summary>
  96. /// <remarks>
  97. /// Land co-ordinates are zero indexed. The inputs are treated as points. So if you want to create a bitmap
  98. /// that covers an entire 256 x 256m region apart from a strip of land on the east, then you would need to
  99. /// specify start_x = 0, start_y = 0, end_x = 252 (or anything up to 255), end_y = 255.
  100. ///
  101. /// At the moment, the smallest parcel of land is 4m x 4m, so if the
  102. /// region is 256 x 256m (the SL size), the bitmap returned will start at (0,0) and end at (63,63).
  103. /// The value of the set_value needs to be true to define an active parcel of the given size.
  104. /// </remarks>
  105. /// <param name="start_x"></param>
  106. /// <param name="start_y"></param>
  107. /// <param name="end_x"></param>
  108. /// <param name="end_y"></param>
  109. /// <param name="set_value"></param>
  110. /// <returns>The bitmap created.</returns>
  111. bool[,] GetSquareLandBitmap(int start_x, int start_y, int end_x, int end_y, bool set_value = true);
  112. bool[,] ModifyLandBitmapSquare(bool[,] land_bitmap, int start_x, int start_y, int end_x, int end_y, bool set_value);
  113. /// <summary>
  114. /// Merge two (same size) land bitmaps.
  115. /// </summary>
  116. /// <param name="bitmap_base"></param>
  117. /// <param name="bitmap_add"></param>
  118. /// <returns>The modified bitmap.</returns>
  119. bool[,] MergeLandBitmaps(bool[,] bitmap_base, bool[,] bitmap_add);
  120. /// <summary>
  121. /// Remap a land bitmap. Takes the supplied land bitmap and rotates it, crops it and finally offsets it into
  122. /// a final land bitmap of the target region size.
  123. /// </summary>
  124. /// <param name="bitmap_base">The original parcel bitmap</param>
  125. /// <param name="rotationDegrees"></param>
  126. /// <param name="displacement">&lt;x,y,?&gt;</param>
  127. /// <param name="boundingOrigin">&lt;x,y,?&gt;</param>
  128. /// <param name="boundingSize">&lt;x,y,?&gt;</param>
  129. /// <param name="regionSize">&lt;x,y,?&gt;</param>
  130. /// <param name="isEmptyNow">out: This is set if the resultant bitmap is now empty</param>
  131. /// <param name="AABBMin">out: parcel.AABBMin &lt;x,y,0&gt</param>
  132. /// <param name="AABBMax">out: parcel.AABBMax &lt;x,y,0&gt</param>
  133. /// <returns>New parcel bitmap</returns>
  134. bool[,] RemapLandBitmap(bool[,] bitmap_base, Vector2 displacement, float rotationDegrees, Vector2 boundingOrigin, Vector2 boundingSize, Vector2 regionSize, out bool isEmptyNow);
  135. /// <summary>
  136. /// Clears any parcel data in bitmap_base where there exists parcel data in bitmap_new. In other words the parcel data
  137. /// in bitmap_new takes over the space of the parcel data in bitmap_base.
  138. /// </summary>
  139. /// <param name="bitmap_base"></param>
  140. /// <param name="bitmap_new"></param>
  141. /// <param name="isEmptyNow">out: This is set if the resultant bitmap is now empty</param>
  142. /// <param name="AABBMin">out: parcel.AABBMin &lt;x,y,0&gt;</param>
  143. /// <param name="AABBMax">out: parcel.AABBMax &lt;x,y,0&gt</param>
  144. /// <returns>New parcel bitmap</returns>
  145. bool[,] RemoveFromLandBitmap(bool[,] bitmap_base, bool[,] bitmap_new, out bool isEmptyNow);
  146. byte[] ConvertLandBitmapToBytes();
  147. bool[,] ConvertBytesToLandBitmap(bool overrideRegionSize = false);
  148. bool IsLandBitmapEmpty(bool[,] landBitmap);
  149. void DebugLandBitmap(bool[,] landBitmap);
  150. void SendForceObjectSelect(int local_id, int request_type, List<UUID> returnIDs, IClientAPI remote_client);
  151. void SendLandObjectOwners(IClientAPI remote_client);
  152. void ReturnLandObjects(uint type, UUID[] owners, UUID[] tasks, IClientAPI remote_client);
  153. void ResetOverMeRecord();
  154. void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area);
  155. void DeedToGroup(UUID groupID);
  156. void SetParcelObjectMaxOverride(overrideParcelMaxPrimCountDelegate overrideDel);
  157. void SetSimulatorObjectMaxOverride(overrideSimulatorMaxPrimCountDelegate overrideDel);
  158. void StoreEnvironment(ViewerEnvironment VEnv);
  159. /// <summary>
  160. /// Set the media url for this land parcel
  161. /// </summary>
  162. /// <param name="url"></param>
  163. void SetMediaUrl(string url);
  164. /// <summary>
  165. /// Set the music url for this land parcel
  166. /// </summary>
  167. /// <param name="url"></param>
  168. void SetMusicUrl(string url);
  169. /// <summary>
  170. /// Get the music url for this land parcel
  171. /// </summary>
  172. /// <returns>The music url.</returns>
  173. string GetMusicUrl();
  174. void Clear();
  175. ISceneObject[] GetSceneObjectGroups();
  176. }
  177. }