OpenSim
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
LandData.cs
Go to the documentation of this file.
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 
28 using System;
29 using System.Collections.Generic;
30 using System.Xml;
31 using System.Xml.Serialization;
32 
33 using OpenMetaverse;
34 
35 namespace OpenSim.Framework
36 {
37  public class LandAccessEntry
38  {
39  public UUID AgentID;
40  public int Expires;
41  public AccessList Flags;
42  }
43 
47  public class LandData
48  {
49  // use only one serializer to give the runtime a chance to
50  // optimize it (it won't do that if you use a new instance
51  // every time)
52  private static XmlSerializer serializer = new XmlSerializer(typeof(LandData));
53 
54  private Vector3 _AABBMax = new Vector3();
55  private Vector3 _AABBMin = new Vector3();
56  private int _area = 0;
57  private uint _auctionID = 0; //Unemplemented. If set to 0, not being auctioned
58  private UUID _authBuyerID = UUID.Zero; //Unemplemented. Authorized Buyer's UUID
59  private ParcelCategory _category = ParcelCategory.None; //Unemplemented. Parcel's chosen category
60  private int _claimDate = 0;
61  private int _claimPrice = 0; //Unemplemented
62  private UUID _globalID = UUID.Zero;
63  private UUID _groupID = UUID.Zero;
64  private bool _isGroupOwned = false;
65  private byte[] _bitmap = new byte[512];
66  private string _description = String.Empty;
67 
68  private uint _flags = (uint)ParcelFlags.AllowFly | (uint)ParcelFlags.AllowLandmark |
69  (uint)ParcelFlags.AllowAPrimitiveEntry |
70  (uint)ParcelFlags.AllowDeedToGroup |
71  (uint)ParcelFlags.CreateObjects | (uint)ParcelFlags.AllowOtherScripts |
72  (uint)ParcelFlags.AllowVoiceChat;
73 
74  private byte _landingType = (byte)OpenMetaverse.LandingType.Direct;
75  private string _name = "Your Parcel";
76  private ParcelStatus _status = ParcelStatus.Leased;
77  private int _localID = 0;
78  private byte _mediaAutoScale = 0;
79  private UUID _mediaID = UUID.Zero;
80  private string _mediaURL = String.Empty;
81  private string _musicURL = String.Empty;
82  private UUID _ownerID = UUID.Zero;
83  private List<LandAccessEntry> _parcelAccessList = new List<LandAccessEntry>();
84  private float _passHours = 0;
85  private int _passPrice = 0;
86  private int _salePrice = 0; //Unemeplemented. Parcels price.
87  private int _simwideArea = 0;
88  private int _simwidePrims = 0;
89  private UUID _snapshotID = UUID.Zero;
90  private Vector3 _userLocation = new Vector3();
91  private Vector3 _userLookAt = new Vector3();
92  private int _otherCleanTime = 0;
93  private string _mediaType = "none/none";
94  private string _mediaDescription = "";
95  private int _mediaHeight = 0;
96  private int _mediaWidth = 0;
97  private bool _mediaLoop = false;
98  private bool _obscureMusic = false;
99  private bool _obscureMedia = false;
100  private float _dwell = 0;
101 
102  public bool SeeAVs { get; set; }
103  public bool AnyAVSounds { get; set; }
104  public bool GroupAVSounds { get; set; }
105 
109  [XmlIgnore]
110  public float Dwell
111  {
112  get
113  {
114  return _dwell;
115  }
116  set
117  {
118  _dwell = value;
119  }
120  }
121 
125  [XmlIgnore]
126  public bool ObscureMedia
127  {
128  get
129  {
130  return _obscureMedia;
131  }
132  set
133  {
134  _obscureMedia = value;
135  }
136  }
137 
141  [XmlIgnore]
142  public bool ObscureMusic
143  {
144  get
145  {
146  return _obscureMusic;
147  }
148  set
149  {
150  _obscureMusic = value;
151  }
152  }
153 
157  [XmlIgnore]
158  public bool MediaLoop
159  {
160  get
161  {
162  return _mediaLoop;
163  }
164  set
165  {
166  _mediaLoop = value;
167  }
168  }
169 
173  [XmlIgnore]
174  public int MediaHeight
175  {
176  get
177  {
178  return _mediaHeight;
179  }
180  set
181  {
182  _mediaHeight = value;
183  }
184  }
185 
189  [XmlIgnore]
190  public int MediaWidth
191  {
192  get
193  {
194  return _mediaWidth;
195  }
196  set
197  {
198  _mediaWidth = value;
199  }
200  }
201 
205  [XmlIgnore]
206  public Vector3 AABBMax
207  {
208  get
209  {
210  return _AABBMax;
211  }
212  set
213  {
214  _AABBMax = value;
215  }
216  }
220  [XmlIgnore]
221  public Vector3 AABBMin
222  {
223  get
224  {
225  return _AABBMin;
226  }
227  set
228  {
229  _AABBMin = value;
230  }
231  }
232 
236  public int Area
237  {
238  get
239  {
240  return _area;
241  }
242  set
243  {
244  _area = value;
245  }
246  }
247 
251  public uint AuctionID
252  {
253  get
254  {
255  return _auctionID;
256  }
257  set
258  {
259  _auctionID = value;
260  }
261  }
262 
266  public UUID AuthBuyerID
267  {
268  get
269  {
270  return _authBuyerID;
271  }
272  set
273  {
274  _authBuyerID = value;
275  }
276  }
277 
281  public ParcelCategory Category
282  {
283  get
284  {
285  return _category;
286  }
287  set
288  {
289  _category = value;
290  }
291  }
292 
296  public int ClaimDate
297  {
298  get
299  {
300  return _claimDate;
301  }
302  set
303  {
304  _claimDate = value;
305  }
306  }
307 
311  public int ClaimPrice
312  {
313  get
314  {
315  return _claimPrice;
316  }
317  set
318  {
319  _claimPrice = value;
320  }
321  }
322 
326  public UUID GlobalID
327  {
328  get
329  {
330  return _globalID;
331  }
332  set
333  {
334  _globalID = value;
335  }
336  }
337 
341  public UUID GroupID
342  {
343  get
344  {
345  return _groupID;
346  }
347  set
348  {
349  _groupID = value;
350  }
351  }
352 
356  public bool IsGroupOwned
357  {
358  get
359  {
360  return _isGroupOwned;
361  }
362  set
363  {
364  _isGroupOwned = value;
365  }
366  }
367 
371  public byte[] Bitmap
372  {
373  get
374  {
375  return _bitmap;
376  }
377  set
378  {
379  _bitmap = value;
380  }
381  }
382 
386  public string Description
387  {
388  get
389  {
390  return _description;
391  }
392  set
393  {
394  _description = value;
395  }
396  }
397 
401  public uint Flags
402  {
403  get
404  {
405  return _flags;
406  }
407  set
408  {
409  _flags = value;
410  }
411  }
412 
417  public byte LandingType
418  {
419  get
420  {
421  return _landingType;
422  }
423  set
424  {
425  _landingType = value;
426  }
427  }
428 
432  public string Name
433  {
434  get
435  {
436  return _name;
437  }
438  set
439  {
440  _name = value;
441  }
442  }
443 
447  public ParcelStatus Status
448  {
449  get
450  {
451  return _status;
452  }
453  set
454  {
455  _status = value;
456  }
457  }
458 
462  public int LocalID
463  {
464  get
465  {
466  return _localID;
467  }
468  set
469  {
470  _localID = value;
471  }
472  }
473 
477  public byte MediaAutoScale
478  {
479  get
480  {
481  return _mediaAutoScale;
482  }
483  set
484  {
485  _mediaAutoScale = value;
486  }
487  }
488 
492  public UUID MediaID
493  {
494  get
495  {
496  return _mediaID;
497  }
498  set
499  {
500  _mediaID = value;
501  }
502  }
503 
507  public string MediaURL
508  {
509  get
510  {
511  return _mediaURL;
512  }
513  set
514  {
515  _mediaURL = value;
516  }
517  }
518 
519  public string MediaType
520  {
521  get
522  {
523  return _mediaType;
524  }
525  set
526  {
527  _mediaType = value;
528  }
529  }
530 
534  public string MusicURL
535  {
536  get
537  {
538  return _musicURL;
539  }
540  set
541  {
542  _musicURL = value;
543  }
544  }
545 
550  public UUID OwnerID
551  {
552  get
553  {
554  return _ownerID;
555  }
556  set
557  {
558  _ownerID = value;
559  }
560  }
561 
565  public List<LandAccessEntry> ParcelAccessList
566  {
567  get
568  {
569  return _parcelAccessList;
570  }
571  set
572  {
573  _parcelAccessList = value;
574  }
575  }
576 
580  public float PassHours
581  {
582  get
583  {
584  return _passHours;
585  }
586  set
587  {
588  _passHours = value;
589  }
590  }
591 
595  public int PassPrice
596  {
597  get
598  {
599  return _passPrice;
600  }
601  set
602  {
603  _passPrice = value;
604  }
605  }
606 
610  public int SalePrice
611  {
612  get
613  {
614  return _salePrice;
615  }
616  set
617  {
618  _salePrice = value;
619  }
620  }
621 
625  [XmlIgnore]
626  public int SimwideArea
627  {
628  get
629  {
630  return _simwideArea;
631  }
632  set
633  {
634  _simwideArea = value;
635  }
636  }
637 
641  [XmlIgnore]
642  public int SimwidePrims
643  {
644  get
645  {
646  return _simwidePrims;
647  }
648  set
649  {
650  _simwidePrims = value;
651  }
652  }
653 
657  public UUID SnapshotID
658  {
659  get
660  {
661  return _snapshotID;
662  }
663  set
664  {
665  _snapshotID = value;
666  }
667  }
668 
673  public Vector3 UserLocation
674  {
675  get
676  {
677  return _userLocation;
678  }
679  set
680  {
681  _userLocation = value;
682  }
683  }
684 
689  public Vector3 UserLookAt
690  {
691  get
692  {
693  return _userLookAt;
694  }
695  set
696  {
697  _userLookAt = value;
698  }
699  }
700 
705  public int OtherCleanTime
706  {
707  get
708  {
709  return _otherCleanTime;
710  }
711  set
712  {
713  _otherCleanTime = value;
714  }
715  }
716 
720  public string MediaDescription
721  {
722  get
723  {
724  return _mediaDescription;
725  }
726  set
727  {
728  _mediaDescription = value;
729  }
730  }
731 
732  public LandData()
733  {
734  _globalID = UUID.Random();
735  SeeAVs = true;
736  AnyAVSounds = true;
737  GroupAVSounds = true;
738  }
739 
744  public LandData Copy()
745  {
746  LandData landData = new LandData();
747 
748  landData._AABBMax = _AABBMax;
749  landData._AABBMin = _AABBMin;
750  landData._area = _area;
751  landData._auctionID = _auctionID;
752  landData._authBuyerID = _authBuyerID;
753  landData._category = _category;
754  landData._claimDate = _claimDate;
755  landData._claimPrice = _claimPrice;
756  landData._globalID = _globalID;
757  landData._groupID = _groupID;
758  landData._isGroupOwned = _isGroupOwned;
759  landData._localID = _localID;
760  landData._landingType = _landingType;
761  landData._mediaAutoScale = _mediaAutoScale;
762  landData._mediaID = _mediaID;
763  landData._mediaURL = _mediaURL;
764  landData._musicURL = _musicURL;
765  landData._ownerID = _ownerID;
766  landData._bitmap = (byte[])_bitmap.Clone();
767  landData._description = _description;
768  landData._flags = _flags;
769  landData._name = _name;
770  landData._status = _status;
771  landData._passHours = _passHours;
772  landData._passPrice = _passPrice;
773  landData._salePrice = _salePrice;
774  landData._snapshotID = _snapshotID;
775  landData._userLocation = _userLocation;
776  landData._userLookAt = _userLookAt;
777  landData._otherCleanTime = _otherCleanTime;
778  landData._mediaType = _mediaType;
779  landData._mediaDescription = _mediaDescription;
780  landData._mediaWidth = _mediaWidth;
781  landData._mediaHeight = _mediaHeight;
782  landData._mediaLoop = _mediaLoop;
783  landData._obscureMusic = _obscureMusic;
784  landData._obscureMedia = _obscureMedia;
785  landData._simwideArea = _simwideArea;
786  landData._simwidePrims = _simwidePrims;
787  landData._dwell = _dwell;
788  landData.SeeAVs = SeeAVs;
789  landData.AnyAVSounds = AnyAVSounds;
790  landData.GroupAVSounds = GroupAVSounds;
791 
792  landData._parcelAccessList.Clear();
793  foreach (LandAccessEntry entry in _parcelAccessList)
794  {
795  LandAccessEntry newEntry = new LandAccessEntry();
796  newEntry.AgentID = entry.AgentID;
797  newEntry.Flags = entry.Flags;
798  newEntry.Expires = entry.Expires;
799 
800  landData._parcelAccessList.Add(newEntry);
801  }
802 
803  return landData;
804  }
805 
806 // public void ToXml(XmlWriter xmlWriter)
807 // {
808 // serializer.Serialize(xmlWriter, this);
809 // }
810 
816 // public static LandData FromXml(XmlReader xmlReader)
817 // {
818 // LandData land = (LandData)serializer.Deserialize(xmlReader);
819 //
820 // return land;
821 // }
822  }
823 }
int Expires
Definition: LandData.cs:40
AccessList Flags
Definition: LandData.cs:41
Definition: LandData.cs:37
LandData Copy()
Make a new copy of the land data
Definition: LandData.cs:744
Details of a Parcel of land
Definition: LandData.cs:47
UUID AgentID
Definition: LandData.cs:39