From f23f7b1fc4e272a0d6796aee0ef665a4d3821cf8 Mon Sep 17 00:00:00 2001 From: "dr scofield (aka dirk husemann)" Date: Fri, 4 Sep 2009 10:08:33 +0200 Subject: [PATCH] preparing LandData seriali(s|z)ation into OAR [not yet functional] --- OpenSim/Framework/LandData.cs | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/OpenSim/Framework/LandData.cs b/OpenSim/Framework/LandData.cs index e639da0636..071a66758f 100644 --- a/OpenSim/Framework/LandData.cs +++ b/OpenSim/Framework/LandData.cs @@ -27,6 +27,9 @@ using System; using System.Collections.Generic; +using System.Xml; +using System.Xml.Serialization; + using OpenMetaverse; namespace OpenSim.Framework @@ -36,6 +39,11 @@ namespace OpenSim.Framework /// public class LandData { + // use only one serializer to give the runtime a chance to + // optimize it (it won't do that if you use a new instance + // every time) + private static XmlSerializer serializer = new XmlSerializer(typeof (LandData)); + private Vector3 _AABBMax = new Vector3(); private Vector3 _AABBMin = new Vector3(); private int _area = 0; @@ -86,6 +94,7 @@ namespace OpenSim.Framework /// /// Upper corner of the AABB for the parcel /// + [XmlIgnore] public Vector3 AABBMax { get { return _AABBMax; @@ -97,6 +106,7 @@ namespace OpenSim.Framework /// /// Lower corner of the AABB for the parcel /// + [XmlIgnore] public Vector3 AABBMin { get { return _AABBMin; @@ -205,6 +215,7 @@ namespace OpenSim.Framework /// /// Number of SceneObjectPart that are owned by a Group /// + [XmlIgnore] public int GroupPrims { get { return _groupPrims; @@ -363,6 +374,7 @@ namespace OpenSim.Framework /// Number of SceneObjectPart that are owned by users who do not own the parcel /// and don't have the 'group. These are elegable for AutoReturn collection /// + [XmlIgnore] public int OtherPrims { get { return _otherPrims; @@ -388,6 +400,7 @@ namespace OpenSim.Framework /// /// Number of SceneObjectPart that are owned by the owner of the parcel /// + [XmlIgnore] public int OwnerPrims { get { return _ownerPrims; @@ -448,6 +461,7 @@ namespace OpenSim.Framework /// /// Number of SceneObjectPart that are currently selected by avatar /// + [XmlIgnore] public int SelectedPrims { get { return _selectedPrims; @@ -460,6 +474,7 @@ namespace OpenSim.Framework /// /// Number of meters^2 in the Simulator /// + [XmlIgnore] public int SimwideArea { get { return _simwideArea; @@ -472,6 +487,7 @@ namespace OpenSim.Framework /// /// Number of SceneObjectPart in the Simulator /// + [XmlIgnore] public int SimwidePrims { get { return _simwidePrims; @@ -607,5 +623,22 @@ namespace OpenSim.Framework return landData; } + + public void ToXml(XmlWriter xmlWriter) + { + serializer.Serialize(xmlWriter, this); + } + + /// + /// Restore a LandData object from the serialized xml representation. + /// + /// + /// + public static LandData FromXml(XmlReader xmlReader) + { + LandData land = (LandData)serializer.Deserialize(xmlReader); + + return land; + } } }